PDA

View Full Version : Obtaining coordinates of transformed vertex.



jojo555
03-23-2004, 12:01 AM
After Applying modeling transformations to a vertex, is the result stored in the vertex itself.
for ex.,
V1 = 10.0,10.0,10.0;

after applying glTranslatef(0.0, 2.0, 0.0) to V1,
will V1 now become 10.0, 12.0, 10.0 ?

If not, how can i obtain the coordinates of transformed vertex?
Thanks.

mikael_aronsson
03-23-2004, 12:32 AM
Hi !

There is no easy way to do that, and if where you would not want to use it because you would slow down everything a bit, normally you keep track of the transformations yourself.

A matrix is used to keep track of the transformations, you can add translations, rotations and scaling to a matrix and then use glMultMatrix to add that compound transformation to OpenGL, then you can use glPopMatrix/glPushMatrix to handle everything.

There are lots of tutorials on matrices out there and on www.sourceforge.net (http://www.sourceforge.net) for example you can find libraries that handles all the math for you.

Mikael