Skip to main content
GameDev.net gamedev.net
🔒 Locked

The Modelview Matrix?

Started by Ranger_One Jan 10, 2002 at 8:38 PM 0 replies 200+ views
Original Post
Ranger_One
Ranger_One
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
Dwarf with Axe
Dwarf with Axe
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.