Exemplo n.º 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)
}
Exemplo n.º 2
0
func renderNode(data *renderData, color pack.Color, pos point3d, size float32) {
	gl.LoadIdentity()

	gl.Translated(0, 0, data.zoom)
	gl.Rotated(data.xrot, 1, 0, 0)
	gl.Rotated(data.yrot, 0, 1, 0)

	gl.Translatef(pos.X, pos.Y, pos.Z)
	gl.Scalef(size, size, size)

	gl.Color3f(color.R, color.G, color.B)
	gl.CallList(data.box)
}
Exemplo n.º 3
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()
}