func init() { // right[0], front[1], top[2] = 1.0, 1.0, 1.0 matrix[3][3] = 1. for l := 0; l < MaxL; l++ { lightSource[l] = vect.New() } w := 2.0 * math.Pi / float64(nLamp) sin[0], cos[0] = C.GLdouble(0.0), C.GLdouble(1.0) sin[nLamp], cos[nLamp] = sin[0], cos[0] for g := 1; g < nLamp; g++ { sin[g] = C.GLdouble(math.Sin(float64(g) * w)) cos[g] = C.GLdouble(math.Cos(float64(g) * w)) } sin[nLamp+1], sin[1] = cos[nLamp+1], cos[1] // C.glDepthFunc (C.GL_LESS) // default C.glEnable(C.GL_DEPTH_TEST) C.glShadeModel(C.GL_SMOOTH) for i := 0; i < 3; i++ { lmAmb[i] = C.GLfloat(0.2) } // default: 0.2 lmAmb[3] = C.GLfloat(1.0) // default: 1.0 C.glLightModelfv(C.GL_LIGHT_MODEL_AMBIENT, &lmAmb[0]) for i := 0; i < 3; i++ { mAmbi[i] = C.GLfloat(0.2) } // default: 0.2 mAmbi[3] = C.GLfloat(1.0) // default: 1.0 // C.glLightModelfv (C.GL_LIGHT_MODEL_TWO_SIDE, 1) C.glMaterialfv(C.GL_FRONT_AND_BACK, C.GL_AMBIENT_AND_DIFFUSE, &mAmbi[0]) for i := 0; i < 3; i++ { mDiff[i] = C.GLfloat(0.8) } // default: 0.8 mDiff[3] = C.GLfloat(1.0) // default: 1.0 w = 1. C.glClearDepth(C.GLclampd(w)) // C.glMaterialfv (C.GL_FRONT_AND_BACK, C.GL_DIFFUSE, mDiff) // C.glColorMaterial (C.GL_FRONT_AND_BACK, C.GL_DIFFUSE) // C.glColorMaterial (C.GL_FRONT, C.GL_AMBIENT) C.glColorMaterial(C.GL_FRONT_AND_BACK, C.GL_AMBIENT_AND_DIFFUSE) C.glEnable(C.GL_COLOR_MATERIAL) C.glEnable(C.GL_LIGHTING) initialize() }
// DepthRange calls glDepthRange func DepthRange(zNear, zFar float64) { C.glDepthRange(C.GLclampd(zNear), C.GLclampd(zFar)) }
//void glDepthRange (GLclampd zNear, GLclampd zFar) func DepthRange(zNear GLclampd, zFar GLclampd) { C.glDepthRange(C.GLclampd(zNear), C.GLclampd(zFar)) }
//void glClearDepth (GLclampd depth) func ClearDepth(depth GLclampd) { C.glClearDepth(C.GLclampd(depth)) }