Sign in to follow this  
bensta00

OpenGL projection matrix (solved)

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

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