projection matrix (solved)

Started by
0 comments, last by bensta00 17 years, 11 months ago
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]
Advertisement
Idiotic, but, I needed to transpose the matrix.

This topic is closed to new replies.

Advertisement