ray
ray

Reputation: 2045

What's the difference between these matrix modes?

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?

Upvotes: 7

Views: 4060

Answers (2)

epatel
epatel

Reputation: 46049

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...

Upvotes: 6

NeARAZ
NeARAZ

Reputation: 6035

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.

Upvotes: 3

Related Questions