PDA

View Full Version : Getting the 2D screen coordinates of an object in 3D space



kellog
04-18-2004, 11:07 AM
Hi, just wondering if there was a quick and easy way to get the 2D screen coordinates of an object in 3D space.

For example, say that I have a object in 3D space that could be anywhere along the x,y and z axis is there a way to find out the objects origin in relation to its actual screen position? So, if the object is draw at the bottom lefthand side of the screen its origin should be x=0, y=0.

Hope that's clear enough.

Cheers

plasmonster
04-18-2004, 11:24 AM
kellog, the easy answer is use gluProject(...). It will take world coords and convert them into screen coords for you. Another option is to calculate them yourself. If you dig around in the red book, you'll find enough info to do it.

kellog
04-18-2004, 11:35 AM
Ok, Cheers Portal, I'll look into it.