Archived

This topic is now archived and is closed to further replies.

The Modelview Matrix?

This topic is 5819 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I have a working engine- but a question... Why would you use the modelview matrix? It doesn''t seem to work for me. Right now my engine sets the glMatrixMode(GL_PROJECTION); and goes into it''s render mode fine. I tried for curiosities sake, placing a glMatrixMode(GL_MODELVIEW); before entering the render loop. WOAH. The colors disappear- and then when I rotate the ''world'' 180d, then they return. Why? and since everything works in GL_PROJECTION, why would someone use the modelview matrix? Ranger

Share this post


Link to post
Share on other sites
The matrices that are most commonly used are GL_PROJECTION and GL_MODELVIEW.

(Analogy time)
Before your scene is properly rendered, you need to setup your camera. You do this by modifying the projection matrix. All setup calls (glOrtho, gluPerspective, etc.) should be in the projection matrix. NOTHING ELSE.

The scene is rendered inside the modelmatrix and viewmatrix. Makes sense to put the objects in the model matrix, doesn''t it? Well, of course it does.

This is very important:

GL_PROJECTION should be used ONLY to setup your camera. This means choosing your lens, allocating your field of view, etc.

GL_MODELVIEW should be used ALWAYS for drawing objects, modifying them, and any other general drawings.

Hope this helps?

~Dwarf

Share this post


Link to post
Share on other sites