Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between these matrix modes?

Tags:

theory

opengl

GL_PROJECTION and GL_MODELVIEW.

I know there are others, but I, conceptually, can't figure out what the difference between any of them are. When you load the identity matrix after setting the mode, how is the identity matrix any different based on the mode?

like image 434
ray Avatar asked Feb 16 '09 12:02

ray


2 Answers

One could say that the GL_PROJECTION is for setting up the camera as what it's like, wide lens etc and one could say that GL_MODELVIEW is for setting up the object that is to be drawn, like size and place in space etc.

To position the camera look at the gluLookAt function...

like image 186
epatel Avatar answered Oct 02 '22 15:10

epatel


The matrix modes do not change the matrix itself, so identity matrix is identity matrix everywhere.

The matrix modes change which matrix the following commands operate on. That is, whether any subsequent commands work with the projection matrix, or with model*view matrix, or with texture matrices etc.

This might sound a bit confusing, but it's one of OpenGL's design decisions - there's a bunch of commands that operate on some state or object, and only other state settings determine which object exactly they operate on.

like image 29
NeARAZ Avatar answered Oct 02 '22 15:10

NeARAZ