PDA

View Full Version : How can I detect a surface on 3D object by mouse click?



yin
01-24-2002, 06:10 AM
I rendered a 3D object using OpenGL, e.g, a cube.
Is there any method to detect which surface on the cube I choose by mouse click?

thanks a lot...

opla
01-24-2002, 06:39 AM
Yes, there is http://www.opengl.org/discussion_boards/ubb/wink.gif

you can use the selection buffer (slow on ATI cards) or compute everything yourself (the only way using DirectX).

see http://nehe.gamedev.net/tutorials/lesson33.asp

Spaceboy
01-24-2002, 06:21 PM
yes u can
when u click the surafce on the 3d object, u can acquire the x,y,z of the point on the object. based on the topological relationship between object and surface. u can detect the surface that the mouse hit . wish it is useful for u