func DrawAABB(aabb Drawable, t float32, program gl.Program) { box := aabb.GetBox3D() nverts, normals := GetVerts() if box.Animator != nil { box.Animator(&box, t) } drawPos := box.Pos drawColor := box.Color drawSize := box.Size program.GetUniformLocation("SizeVec").Uniform3f(drawSize.X, drawSize.Y, drawSize.Z) program.GetUniformLocation("PosVec").Uniform3f(drawPos.X, drawPos.Y, drawPos.Z) gl.Color3f(drawColor.X, drawColor.Y, drawColor.Z) gl.EnableClientState(gl.VERTEX_ARRAY) gl.VertexPointer(3, 0, nverts) gl.EnableClientState(gl.NORMAL_ARRAY) gl.NormalPointer(0, normals) gl.DrawArrays(gl.QUADS, 0, 24) gl.DisableClientState(gl.NORMAL_ARRAY) gl.DisableClientState(gl.VERTEX_ARRAY) for it := aabb.GetChildren(); it != nil; it = it.Next() { DrawAABB(it.Value.(Drawable), t, program) } }
func (gd *openGLGraphicsDevice) SetNormals(buffer VertexBuffer) { glbuffer := buffer.(*openGLVertexBuffer) gl.EnableClientState(gl.NORMAL_ARRAY) // TODO: DisableClientState gl.NormalPointer(3*4, &glbuffer.vertices3[0].X) }