View Full Version : How can I detect a surface on 3Dobject by mouse click?
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...
01-25-2002, 12:56 AM
You use selection mode, something like this:
Then you render then scene again and before you render each face of the cube you use glLoadName( n); when n is a unique identifier, used to identify that surface.
You then switch back with:
And get the result which is a list of id values of things that where hit.
This is very oversimplified, you must also set the picking matrix and a few other things before it will work.
You can find more info in the FAQ on this website, for examples on selection you can have a peek at the demo examples included with Mesa or GLUT.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.