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?
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.
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…
I suppose I’d have to query for some matricies. But is there a single call I can use?
You can also create/track your own matrices if you are feeling ambitious…
…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.