Sign in to follow this  
Lode

OpenGL GL_MODELVIEW and GL_PROJECTION

Recommended Posts

Does it normally make any difference what you use the matrix GL_MODELVIEW or GL_PROJECTION for? For example, I use GL_PROJECTION for the prespective projection, but use GL_MODELVIEW for the direction and position of the camera. Can it normally work that way, or should I put those in the GL_PROJECTION matrix instead? I have to invert the 3x3 part with u, v and direction for some reason and I'm not sure it could be because of me using the wrong matrix in OpenGL.

Share this post


Link to post
Share on other sites
Quote:
Original post by Lode
Does it normally make any difference what you use the matrix GL_MODELVIEW or GL_PROJECTION for?

For example, I use GL_PROJECTION for the prespective projection, but use GL_MODELVIEW for the direction and position of the camera.

Can it normally work that way, or should I put those in the GL_PROJECTION matrix instead? I have to invert the 3x3 part with u, v and direction for some reason and I'm not sure it could be because of me using the wrong matrix in OpenGL.
I'm not sure what you mean by inverting the 3x3 part, but whatever problem you're running into most likely has to do with something else (such as conflicting notational conventions) rather than which OpenGL matrix mode you're using.

The OpenGL matrix modes are intended to be used as their names suggest, more or less. The projection matrix is for transformation of geometry from view to clipping space, usually by way of a perspective or orthographic projection. The modelview matrix is for transformation of geometry from model to view space (therefore the camera/view transform most correctly goes in the modelview matrix).

I believe you can 'misuse' the different OpenGL matrices and still get correct results in some cases, but it's not advisable.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this