3d-vertex to 2d-screencoordinates

Started by
3 comments, last by IStrikerI 22 years, 6 months ago
i need to convert a 3d-vertex to 2d-screencoordinates. how can i do that ? i thought about doing a special calculation with the vertex and the two matrices (projection and modelview).
Advertisement
ScreenX = X/Z
ScreenY = Y/Z
ScreenZ = Z/Z = 1

giving you the (x,y) co-ords. That''s the way I know someone will probably know a better way :p
You can use gluProject and gluUnProject to convert back and forth. If you''re trying to draw a 2D object you can use an orthographic projection matrix.

[Resist Windows XP''s Invasive Production Activation Technology!]
yeah, thats the function i needed !! thx

but if someone has the real mathematical calculation for this,
please tell me !!
I''m not sure of the exact mathematical calculation, but I know the vertex goes through the modelview and projection matrices in order to be displayed on a 2D screen

This topic is closed to new replies.

Advertisement