View Full Version : Diference between GL_MODELVIEW and GL_PROJECTION
06-09-2004, 01:52 AM
I'm trying to understand the diference between these two callings
I am reading the redbook, i am reading tutorials but this topic is steel obscure for me.
I don't know wnen to make the first call or the second.
Can anyone help me out with few words? What is the diference. I don't mean the matrix stacks, but the essential diference...
Thanks a million.
tuko the mexican
06-09-2004, 04:02 AM
The modelview matrix defines how your objects are transformed (meaning translation,rotation and scaling) in your world coordinate frame
The projection matrix defines the properties of the camera that views the objects in the world coordinate frame. Here you typically set the zoom factor, aspect ratio and the near and far clipping planes.
So in most cases you would want to define the projection matrix just once and use the modelview matrix all other times.
The projection matrix is used to create your viewing volume. Imagine a scene in the real world. You don't really see everything around you, only what your eyes allow you to see. If you're a fish for example you see things a bit broader. So when we say that we set up the projection matrix we mean that we set up what we want to see from the scene that we create. I mean you can draw objects anywhere in your world. If they are not inside the view volume you won't see anything. When you create the view volume imagine that you create 6 clipping planes that define your field of view.
As for the modelview matrix, it is used to make various transformations to the models (objects) in your world. Like this you only have to define your object once and then translate it or rotate it or scale it.
You would use the projection matrix before drawing the objects in your scene to set the view volume. Then you draw your object and change the modelview matrix accordingly. Of course you can change your matrix midway of drawing your models if for example you want to draw a scene and then draw some text (which with some methods you can work easier in orthographic projection) then change back to modelview matrix.
As for the name modelview it has to do with the duality of modeling and viewing transformations. If you draw the camera 5 units back, or move the object 5 units forwards it is essentially the same.
Hope I've shed some light.
06-09-2004, 10:06 PM
Also this url might be of assistance: http://sjbaker.org/steve/omniv/projection_abuse.html
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.