View Full Version : Converting vertexes to pixels

05-15-2009, 03:47 PM
Hello, I'm wondering how to convert a world coordinate, with x, y and z values, to x and y pixel values. I've seen the gluProject/gluUnproject methods, but ive heard they're slow. Please help!

05-15-2009, 04:28 PM
Depends on what do you want as result... image or numbers?

05-15-2009, 04:43 PM
Well first of all, what do you mean by an image result? I just want the mouse location that is projected to the screen (in pixels) by a specific point in 3d space

05-16-2009, 02:56 AM
Multiply by the whole enchilada that takes you into screen space - wrong if you're following the spec to the letter as GL applies the perspective division before the viewport transform whereas DX performs it last. Mathematically they're equivalent but numerically they're likely to be different (as Yooyo points out).

I tend to do it the wrong way... *hangs head in shame*

05-17-2009, 09:01 PM
Here's the source code

Why would it be slow if you just want to transform just 1 position?