Understanding OpenGL. I use OpenGL + SDL on Go, but probably it is not so important, it looks like my mistake is in the OpenGL API calls.
I'm trying to work with the camera, but I can not see anything, just a black screen.
First, I set up a projection:
gl.Viewport(0, 0, screenWidth, screenHeight) gl.MatrixMode(gl.PROJECTION) gl.LoadIdentity() glu.Perspective(45, screenWidth/screenHeight, 0.1, 100)
After that install the camera:
gl.MatrixMode(gl.MODELVIEW) gl.LoadIdentity() glu.LookAt( 10, 10, 5, 0, 0, 0, -1, -1, 1)
After that I try to draw the following:
gl.Clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT) gl.Color4f(1, 1, 1, 1) gl.Begin(gl.QUADS) gl.Vertex3d(-20, 20, 0) gl.Vertex3d(20, 20, 0) gl.Vertex3d(20, -20, 0) gl.Vertex3d(-20, -20, 0) gl.End()
But I see only a black screen. Most likely, I somehow do not set up the camera / projection. If suddenly the error is somewhere else here is the complete code .