Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Projection Matrix

This topic is 5897 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is a projection matrix? i''ve heard this term quite alot and wondered what it was.

Share this post

Link to post
Share on other sites
The projection matrix is the matrix used to define the viewing volume in an openGL application.

Here is an example.

// Here is where you set the screen coords for where your

// graphics show up

glViewport(0, 0, screenWidth, screenHeight);

// Now you select the matrix mode. You would use GL_PROJECTION

// to tell openGL that you want to modify/set the projection

// matrix


// Then you load the identity matrix to clear out the projection matrix before you set it


// Then you set the params. Here are each of the params

// 45.0f - This is your frustum view angle

// (GLfloat)width/(GLfloat)height - Not totally clear on this , but I assume it has to do with the top/bottom view angle

// 1.0f - this is the near clip plane of your viewing volume

// 1000.0f - this is the far clip plan of your viewing volume

gluPerspective(45.0f, (GLfloat)width/(GLfloat)height,1.0f, 1000.0f);

// Now set the matrix mode to GL_MODELVIEW so you can view and manipulate the graphics rather than the viewing volume


// Then load the identity matrix again to clear everything out in the modelview matrix

There you go. So thats what the projection matrix really is, just the matrix to define your viewing volume

"With my feet upon the ground I lose myself between the sounds and open wide to suck it in, I feel it move across my skin. I'm reaching up and reaching out. I'm reaching for the random or what ever will bewilder me, what ever will bewilder me. And following our will and wind we may just go where no one's been. We'll ride the spiral to the end and may just go where no one's been." - Maynard James Keenan
[TheBlackJester ]
[Wildfire Studios ]

[edited by - TheBlackJester on August 29, 2002 6:35:32 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!