예제 #1
0
func setupScene() {
	gl.Enable(gl.DEPTH_TEST)
	gl.Enable(gl.LIGHTING)

	gl.ClearColor(0.5, 0.5, 0.5, 0.0)
	gl.ClearDepth(1)
	gl.DepthFunc(gl.LEQUAL)

	ambient := []float32{0.5, 0.5, 0.5, 1}
	diffuse := []float32{1, 1, 1, 1}
	lightPosition := []float32{-5, 5, 10, 0}
	gl.Lightfv(gl.LIGHT0, gl.AMBIENT, &ambient[0])
	gl.Lightfv(gl.LIGHT0, gl.DIFFUSE, &diffuse[0])
	gl.Lightfv(gl.LIGHT0, gl.POSITION, &lightPosition[0])
	gl.Enable(gl.LIGHT0)

	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Frustum(-1, 1, -1, 1, 1.0, 10.0)
	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
}
예제 #2
0
파일: main.go 프로젝트: pietdaniel/gl_maze
// lets get things rolling
func init_() {
	// all for lighting effects
	//pos := []float32{0.0, 0.0, 100.0, 0.0}
	var pos float32 = 1.0
	gl.Lightfv(gl.LIGHT0, gl.POSITION, &pos)
	gl.Enable(gl.LIGHTING)
	gl.Enable(gl.LIGHT0)
	// below is necessary
	gl.Enable(gl.DEPTH_TEST)
	gl.Enable(gl.NORMALIZE)

	if DEBUG {
		tests()
		init_walls()
		return
	} else {
		make_maze()
		init_walls()
	}
}