I'm trying to set up a simple 3d view with pygame and opengl, using frustum to set up the projection matrix. Here is my initialization code:
def initgl(self):
glClearColor(0.0,0.0,0.0,0.0)
glViewport(0,0,640,480)
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
glFrustum(0,640,480,0,.1,1000.)
glMatrixMode(GL_MODELVIEW)
glLoadIdentity()
Here is my display code:
def paintgl(self):
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
glPushMatrix()
glColor3f(1.0,1.0,1.0)
glBegin(GL_QUADS)
glVertex3f(-1.0,-1.0,0.0)
glVertex3f(1.0,-1.0,0.0)
glVertex3f(1.0,1.0,0.0)
glVertex3f(-1.0,1.0,0.0)
glEnd()
glPopMatrix()
What's strange is that when I use glOrtho, then everything is displayed correctly. My question is, what am I doing wrong to get pygame to display this opengl code?
Edit: If I render to a display list, the display list works correctly, only displaying when I call it, but my geometry is still absent
Note that I did change the FOV to be more correct (near is 1 and far is 10) and I pushed my geometry out to 2 on the Z axis, and still nothing.
Fixed it:
I wasn't looking in the right direction. Oh lol.