PDA

View Full Version : Perspective matrix

mr_coolio
01-28-2003, 05:04 AM
could someone please explain to me what the projective matrix does? My results suggest that I have completely misunderstood its purpose. I thought that it defines the co-ordinate transform from world co-ords to camera co-ords. Also, the order in which transformations are applied is a mystery to me.

Thanks

[This message has been edited by mr_coolio (edited 01-28-2003).]

Deiussum
01-28-2003, 05:44 AM
The projection matrix deterimines the shape of the viewing volume. It essentially transforms anything that would be visible into a 1x1x1 cube. In camera analogy, you could potentially think of it as determining what lens you are looking through.

The modelview matrix determines the position/orientation/scale of your scene. There isn't technically something you would think of as a camera in OpenGL. You can simulate camera movement by making that the first thing applied to the modelview matrix. (This is where the "view" portion of modelview comes in.)

For information on the order of operations in calculating vertex coordinates to screen coordinates, you should take a look at the OpenGL specification, which can be found under the documentation link of this main site.

nexusone
01-28-2003, 05:46 AM
The projection matrix sets the 3D space in which openGL will render to the screen.
Sort of like a projector at a theater projects images on the screen.

There is some relation to the coordinate system, in that any object that you want to be displayed must be in the area set to be rendered.

Modelview matrix is for objects and thier placement in your 3D world. This is where you transformations of objects go.

Transformations work sort of backwards:

// This will rotate then translate the object
translate
rotate
draw_object

// While this will translate then rotate the object
// This will case the object to move in a arc, the amount of rotation.

rotate
translate
draw_object

Which will give you two completely diffrent results.

Originally posted by mr_coolio:
could someone please explain to me what the projective matrix does? My results suggest that I have completely misunderstood its purpose. I thought that it defines the co-ordinate transform from world co-ords to camera co-ords. Also, the order in which transformations are applied is a mystery to me.

Thanks

[This message has been edited by mr_coolio (edited 01-28-2003).]

[This message has been edited by nexusone (edited 01-28-2003).]

mr_coolio
01-29-2003, 08:02 AM
Yes, I have misunderstood this projection matrix. Damn - what a lot of wasted time etc. I'm annoyed with myself now.