PDA

View Full Version : Getting transformed verticies back



bgs
07-31-2001, 12:45 PM
Hi there people,
I've been coding using OpenGL for a while, but this little problem's got me stuck. Basically, I'd like a way of getting the final (x, y) pixel coordinates back for verticies. I'm desiging a tool that needs to be able to find the closest vertex onscreen to the mouse pointer, but the view is a 3d rotatable, projected one.
I'm aware I could do it by projecting a vector in the 3d scene and finding the least distance of a vector at a 90 degree angle to it but it's a very expensive approach. I can also replicate the transformation, but that means litterally transforming _every_ vertex twice (once for viewing, once for finding). Can anyone suggest a way around this wasteful step provided by the API?
Thanks,

- Brian

bgs
07-31-2001, 02:06 PM
Sorry, I found (rather by accident) gluProject(). I'm still wondering if there's a way to cache the coordinates so they're not calculated twice though...
- Brian