Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 06 March 2008 - 10:05 AM
Posted 06 March 2008 - 10:33 AM
Posted 06 March 2008 - 03:43 PM
Posted 06 March 2008 - 10:39 PM
Posted 06 March 2008 - 11:48 PM
Posted 07 March 2008 - 03:11 AM
Quote:
Original post by haegarr
BTW, be aware that the PROJECTION matrix does include neither local-to-global nor global-to-eye/camera transformations. So the vertex co-ordinates mentioned in the OP have to already be given relative to the camera's co-ordinate frame.
Posted 07 March 2008 - 04:46 AM
Quote:
Original post by enigmagame Quote:
Original post by haegarr
BTW, be aware that the PROJECTION matrix does include neither local-to-global nor global-to-eye/camera transformations. So the vertex co-ordinates mentioned in the OP have to already be given relative to the camera's co-ordinate frame.
Don't understand this point...
Posted 07 March 2008 - 05:25 AM
Posted 07 March 2008 - 06:50 AM
Quote:Assuming that these steps are done with the GL_MODELVIEW_MATRIX being active, then you've specified said MODELVIEW matrix. But, of course, you have to invoke the camera settings (e.g. gluLookAt) before you invoke the model settings, or else things will go wrong. See below for why.
Original post by enigmagame
I have positioned the model with glTranslate() function, and i setup the camera with the gluLookAt() function.
Quote:The view transformation is part of the MODELVIEW transformation, and you get both in combination if you invoke glGet(GL_MODELVIEW_MATRIX, M). Some people think it is nasty, but OpenGL does it that way. However, you've forgotten about the fact that mathematically column vectors and row vectors have to be distinguished clearly. OpenGL uses column vectors (as opposed to D3D, which uses row vectors). A matrix-vector product with column vectors is written as
Original post by enigmagame
So i must multiply each triangles point for the M (MODELVIEW MATRIX) and then for the P (PROJECTION MATRIX)?
For example if V1, V2, V3 is triangle points:
glGet(GL_MODELVIEW_MATRIX, M);
glGet(GL_PROJECTION_MATRIX, P);
and then
M*P*V1 = V1'
M*P*V2 = V2'
M*P*V3 = V3'
It's correct, or i have forgot the view transformation?
would be the solution you're looking for. Notice please that I assume here that your vector API works with column vectors, since your "code snippet" has shown the vector on the right side.
glGet(GL_MODELVIEW_MATRIX, M);
glGet(GL_PROJECTION_MATRIX, P);
V1' = P*M*V1
Posted 09 March 2008 - 11:09 PM
Quote:
Original post by haegarr
Assuming that these steps are done with the GL_MODELVIEW_MATRIX being active, then you've specified said MODELVIEW matrix. But, of course, you have to invoke the camera settings (e.g. gluLookAt) before you invoke the model settings, or else things will go wrong. See below for why.
Quote:
Original post by haegarr
Taking all this together, I'd say thatwould be the solution you're looking for. Notice please that I assume here that your vector API works with column vectors, since your "code snippet" has shown the vector on the right side.
glGet(GL_MODELVIEW_MATRIX, M);
glGet(GL_PROJECTION_MATRIX, P);
V1' = P*M*V1
glGet(GL_MODELVIEW_MATRIX, M);
glGet(GL_PROJECTION_MATRIX, P);
Posted 10 March 2008 - 01:24 AM
as is returned by glGet, has to be interpreted as a matrix like in
c00 c01 c02 c03 c04 ... c15
[ c00 c04 c08 c12 }
[ c01 c05 c09 c13 }
[ c02 c06 c10 c14 }
[ c03 c07 c11 c15 }
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.