Jump to content
  • Advertisement
Sign in to follow this  

OpenGL projection matrix (solved)

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

I am trying to create my own openGL projection matrix. In this matrix I have encoded everything that should allow a 3D point to be transformed into a 2D normalized device coordinates point. I know this matrix converts a 3D point to the correct 2D point when simply multiplied, but when I set the GL projection matrix to this matrix, geometry is not displayed where it should be. Can anyone help me by describing what the GL projection matrix should do? My matrix takes a 3d point (x, y, z, 1), converts it to (x', y', w', w') and assumes that the OpenGL pipeline then performs x" = x'/w' and y"=y'/w' ready to plot point (x", y"). I have tested the matrix using a raw point plotting function, so there must be something that the GL pipeline is doing before it rasterizes stuff. Is there a document that describes exactly how OpenGL uses the projection matrix to go from 3D points to rasterization? i.e. given 3Dpoint p(x,y,z) 4x4matrix m this works... 3Dpoint pp = m*p double px = pp.x/pp.z; double py = pp.y/pp.z; draw2Dpoint p'(px, py) this doesn't... glMatrixMode(GL_PROJECTION) glLoadID() glMultMatrix(m) draw3Dpoint p Thanks for reading all this, and I hope it makes some sense! [Edited by - bensta00 on May 21, 2006 2:42:43 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • 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!