• Advertisement

Archived

This topic is now archived and is closed to further replies.

converting 3d coordinate to 2d raster position.

This topic is 5971 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im making a small prog to make 3D models in, with curved spline patch surfaces based on a few control points. When making large models, the amount of control points makes it hard to select/mark specific points for manipulation with just using keyboard commands etc.. I need to be able to click on a point (which I only have the 3D coordinate of) with the mouse to select it. I know how to detect mouseclicks, but I cant find out how to get the pixel coordinate on the screen of a given 3D coordinate in the scene. I''d appreciate it if anyone could help me with this.

Share this post


Link to post
Share on other sites
Advertisement
This is called "picking", do a search on the web for an algorithm. Basically you have to take the inverse of the projection matrix to recover the original 3D point. This is covered in most gfx texts.

ECKILLER

Share this post


Link to post
Share on other sites
I mean.....how would I go about implementing that function? How would I know where, for example, a cube at coordinates (1, 2, 3) was in terms of the screen?

Share this post


Link to post
Share on other sites
download the opengl1.3 spec from www.opengl.org
also check here its pretty selfexplanatory
http://www.cevis.uni-bremen.de/~uwe/opengl/gluProject.html

Share this post


Link to post
Share on other sites

  • Advertisement