Пример #1
0
func gluPerspective(fovy float64, aspect float64, zNear float64, zFar float64) {
	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()

	ymax := zNear * math.Tan(fovy*math.Pi/360)
	ymin := -ymax
	xmin := ymin * aspect
	xmax := ymax * aspect

	gl.Frustum(xmin, xmax, ymin, ymax, zNear, zFar)
}
Пример #2
0
func setupGL() {
	gl.ShadeModel(gl.FLAT)
	gl.ClearColor(0.75, 0.75, 0.75, 1.0)

	gl.Enable(gl.DEPTH_TEST)
	gl.LineWidth(1)

	gl.Viewport(0, 0, winWidth, winHeight)
	gl.Hint(gl.PERSPECTIVE_CORRECTION_HINT, gl.NICEST)
	gluPerspective(45, float64(winWidth)/winHeight, 10, 1000)

	gl.MatrixMode(gl.MODELVIEW)
	gl.LoadIdentity()
}