예제 #1
0
파일: imp.go 프로젝트: CaptainSoOmA/Uni
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()
}
예제 #2
0
파일: gl.go 프로젝트: james4k/gl
//void glLightModelfv (GLenum pname, const float *params)
func LightModelfv(pname GLenum, params []float32) {
	if len(params) == 0 {
		panic("Invalid params length")
	}
	C.glLightModelfv(C.GLenum(pname), (*C.GLfloat)(&params[0]))
}
예제 #3
0
파일: gl.go 프로젝트: Nvveen/gl
//void glLightModelfv (GLenum pname, const float *params)
func LightModelfv(pname GLenum, params []float32) {
	if len(params) == 0 {
		panic(ErrorInputSize)
	}
	C.glLightModelfv(C.GLenum(pname), (*C.GLfloat)(&params[0]))
}