Windows has its own mouse operations from what I understand but I haven’t used them that much myself to explain them well… although you may well know those more than me anyway…
GLUT has a set or callback functions that allow you to work with mouse operations so you may want to investigate that avenue.
And then finally a look through gametutorials.com and nehe.gamedev.net may point you into a set of picking tutorials that may help you.
Basically, you click on a pixel and your program is told what to do based on that pixel position. Either locate which object is nearest to that pixel and thus was clicked or create an object and place at that position… and perhaps other similar actions can be carried out.
Originally posted by tinak:
[b]Windows has its own mouse operations from what I understand but I haven’t used them that much myself to explain them well… although you may well know those more than me anyway…
GLUT has a set or callback functions that allow you to work with mouse operations so you may want to investigate that avenue.
And then finally a look through gametutorials.com and nehe.gamedev.net may point you into a set of picking tutorials that may help you.
Basically, you click on a pixel and your program is told what to do based on that pixel position. Either locate which object is nearest to that pixel and thus was clicked or create an object and place at that position… and perhaps other similar actions can be carried out.
It have 2 way to select the 3d object with your mouse.
The gluPickMatrix() can help u to select the objects with your mouse. U can find the examples in red book and internet.
The second method is gluUnPorject(). It also help u to find out the coordinates object in the window from projection matrix and modelview matrix base on your viewport matrix. If u use the gluUnProject(). U can get the x and y coordinates with window function. Then u draw a line to negative z axis . Then u have to check the intersection point of the line. Then u will get the exact x,y,z value…
I hope it can help u …