Hi,
I have been developing a set of tools for visualizing sound models in OpenGL, right now in python. I have a system that works loosely as follows: frames are added to a main class, which all do basic drawing commands. Within the frames lay objects for drawing. Each (including the frame) have a draw() function that will make opengl calls. At the beginning of each frame, a glViewport() call is made with the dimensions for that frame, thereafter normalizing the dimensions within the frame for other objects.
The problem I now need to overcome is how to allow for some frames to draw using frustrum view and others in ortho (or perspective I suppose). Before, I was calling the following in the main resize method:
glFrustum (0.0, 1.0, 0.0, 1.0, 1., 100.0)
gluLookAt (0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
But, this makes everything frustum and nothing can be in 3d. I would like the frames to all be drawn in 2 dimensions, but I would like their contents to be optionally 3d.
So, I tried adding the following to the beginning of the draw() method of the frames:
glViewport(self.x, self.y, self.width, self.height)
glLoadIdentity()
glMatrixMode(GL_PROJECTION)
if self.Ortho:
glOrtho (0.0, 1.0, 0.0, 1.0, 1., 100.0)
else:
glFrustum (0.0, 1.0, 0.0, 1.0, 1., 100.0)
glMatrixMode(GL_MODELVIEW)
But, then I can see nothing in the frame, whether self.Ortho is true or false.
Can anyone tell me if I am on the right track? I am indeed quite new to opengl programming, so it is difficult to know why I am not seeing anything.
regards,
Rich