PDA

View Full Version : Getting Transfomed Coordinates



12-11-2001, 12:20 PM
How do you get 'real world' and viewport coordinates (the result of the current transformations) from some point. I want to save the coords for a selection list as I draw them. This must be simple???

rixed
12-12-2001, 02:22 AM
No, its not simple, because every computation happens on registers on the video card chip, not in system memory.
In fact, the overall design of 3d chip is for displaying only, not to compute geometry for you (of course, they do compute geometry for displaying models, but they do not give you back the results), and so is the openGL API.

The best way is then to compute your geometry yourself as you need it (in general, you do not need the position of every point of every objects : you need the position of the center of object and perhaps the position of some control-points).

If you really want to know the geometry computed by the video chip, for debugging purpose or whatever, try to glMultiply a matrix with your coordinates as the translation and Identity as rotation, then glGet the top matrix.

(IMHO)

Platinum
12-13-2001, 10:16 PM
Cannot this be easily done by glProject and glUnProject ????