PDA

View Full Version : global coordinates



12-09-2001, 12:38 PM
How do I get a vertex's global coordinates after I do severl PushMatrix/translate,multmatrix,scale, etc.

for example (psudocode)

glLoadIdentity
glPushmatrix
gltranslate
glrotate

glPushMatrix
glscale
glMultMatrix

glVertex3f X, Y, Z

glPopmatrix
glPopMatrix

how do I get X,Y, and Z where they would appear in global coordinates?

Korval
12-09-2001, 02:08 PM
If you're interested in performance, then shadow all those matrix calls into your own data structure. Then, you multiply your vertex position by them. Problem solved.

12-09-2001, 03:07 PM
Hmm.. I was hoping for something simpler, but I suppose I could do that, since most of my translation and transformation code is done with MultMatrix anyway. Time to brush up on my matrix multiplication skilz.

12-09-2001, 05:07 PM
Ok, so once I have the modelview matrix, how do I use that to translate the local coordinates back into global coordinates?