[visionegg] Re: GL state responsibility (warning: may contain theory)

  • From: Bertrand Guay-Paquet <bernie@xxxxxxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Wed, 13 Jul 2005 22:33:14 -0400

I should of thought of that... After all, the projection matrix is just another matrix in the chain of vertice transformation. You can put the same transformations there as in the modelview matrix.

Right now if you look at the Projection class (in Core.py), it illustrates what is being done. Essentially there are a series of functions (translate, rotate, look_at, etc...) that all just act on the GL_PROJECTION matrix. Here's an example:

def translate(self,x,y,z):
"""Compose a translation and set the OpenGL projection matrix."""
gl.glMatrixMode(gl.GL_PROJECTION) # Set OpenGL matrix state to modify the projection matrix
gl.glLoadMatrixf(self.parameters.matrix) # Need PyOpenGL >= 2.0
gl.glTranslatef(x,y,z)
self.parameters.matrix = gl.glGetFloatv(gl.GL_PROJECTION_MATRIX)


From what I understand, it's recommended (by the OpenGL people) that all this be done on the GL_MODELVIEW matrix instead of the GL_PROJECTION matrix for all of the stimuli. I think that as long as we don't have too complex of a scene (to overflow the glPushMatrix() stack), the hierarchy method would be a lot more flexible.
Tony


======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html

Other related posts: