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.

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 on other sites
Idiotic, but, I needed to transpose the matrix.

1. 1
Rutin
25
2. 2
3. 3
4. 4
JoeJ
17
5. 5

• 14
• 11
• 9
• 9
• 10
• Forum Statistics

• Total Topics
631754
• Total Posts
3002104
×