PDA

View Full Version : noob question



07-12-2005, 06:17 AM
I have a simple coordinate question. Assume I have point p1. I run my opengl program. I get to a point where I have done a few transformations .. translate,rotate,scaling etc. I get to the point where all the transforms are done and I draw. But at the drawing point, I want to transform p1 also to use with other stuff. How can I transform the point p1? I suppose I'd have to query for some matricies. But is there a single call I can use?

Aeluned
07-12-2005, 06:56 AM
After you perform your transformations (using glScale,Rotate,Translate) every vertex (point) you draw will undergo those transformations.

I'm not sure I understand you correctly, but all you need to do is set up your transformations using the transform calls and then draw your point.

07-12-2005, 07:08 PM
Oh, I understand that what I'm drawing undergoes the transform. opengl draws no problemo.

I just want to see if I have a vertex at p, then what is it when it do the transform. Thats all..

07-12-2005, 08:55 PM
I suppose I'd have to query for some matricies. But is there a single call I can use? http://www.mevis.de/opengl/glGet.html

http://fly.cc.fer.hr/~unreal/theredbook/chapter03.html

You can also create/track your own matrices if you are feeling ambitious...

Aeluned
07-13-2005, 05:13 AM
...You want to find out where your vertex will lie in world space after undergoing the transform?

if that's what you want to do:
perform all the transformations.
do a glGetDoublev(GL_MODELVIEW_MATRIX).
multiply your vertex by the matrix aquired in the above step.

This will give you the new world space coordinates of the vertex after undergoing a transformation defined by the modelview matrix generated by your transforms.