Jump to content
  • Advertisement


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


perspective projection matrix

This topic is 5463 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

Does anyone know how to construct a perspective projection matrix given a FOV, z values of far and near planes, and an aspect ratio??? (without using any API function calls..Thanks...

Share this post

Link to post
Share on other sites
void MATRIX4::SetProjection(float fov,float aspect,float nearplane,float farplane)
float h = cosf(fov / 2) / sinf(fov / 2);
float w = h / aspect;


m[0][0] = w;
m[1][1] = h;
m[2][2] = farplane / (farplane - nearplane);
m[2][3] = 1;
m[3][2] = nearplane * farplane / (nearplane - farplane);

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!