GL_MODELVIEW & GL_PROJECTION

can someone please please explain the difference?? I have a little grasp on it but not enough.

with glmatrixmode you can switch beetween the two matrix stacks. one matrix stack is for the projection “the camera” and the other for your 3dobjects, points lines and triangles. So if you want to rotate and translate objects in your world you must be in modelmatrix mode. if you want to change the view, perspective, near/far clipping planes then you must switch to the projection matrix.

Thanks, that clears things up. but what confuses me is the fact that you can change (rotate etc) anything in MODEL view mode. But Ill just think on it a little more

The modelview matrix is used (or at least should be used) to transform all geometry, so they are all relative to the world origin. When this is done, you apply all kind of features, like lightning, fogging, clipping if needed and things like that. When this is done, OpenGL uses the projection matrix to peoject the geometry onto the screen. And when you have the projected geometry, they are drawn with the properties set after modelview transformation. This is why you put all transformation in the modelview matrix only, because some things is dependant of their psition (like lightning).

By the way,

There are not 2 but 3 matix mode :

  • GL_MODELVIEW,
  • GL_PROJECTION,
  • GL_TEXTURE : for texture effects. Does quake 3 arena shaders mean something for you ?? Well one could done the same using this texture matrix…