PDA

View Full Version : How can I transform 3D Coordinates into 2D screen coordinates



MountainD
03-09-2000, 04:35 AM
I am a french student and I need to pass 3D coordinates into 2D screen coordinates, please help me.

paolom
03-09-2000, 06:11 AM
I am an italian student, and use gluProject (I assume you were asking for how to do it in OpenGL http://www.opengl.org/discussion_boards/ubb/smile.gif).

1) Get current viewing matrix, projection matrix, viewport dimension
2) call gluProject passing x, y, z, and the matrices from point 1)
3) read winx, winy, and winz(!)
The winz coord is used for clipping, I think (I couldn't remeber precisely).
You should be interested in winx and winy.
This is the process as described in the red-book. Have a glance.

[This message has been edited by paolom (edited 03-10-2000).]

bray
03-09-2000, 10:49 AM
this is a handy tutorial for your prob
http://www.velocity.net/~waz/glgamedev/view.cgi?V=tutorial_glfeedback&S=1