OpenGL slection/picking(mouse based) HEELP?
-
I am currently working on a drawing application using openGL and C#..........having a nightmare trying to grasp concept of selection/picking... My application will be drawing 2D(later 3D) objects...the user will be able to select any edge of a polygon and move it around/modify it.. I have seen few tutorials but they were not really useful..i am still confused about how the retreived information in selection mode(Hits records) will help in performing above mentioned editing functions kindly help please suggest links/tutorials (better if in C#) thanks
-
I am currently working on a drawing application using openGL and C#..........having a nightmare trying to grasp concept of selection/picking... My application will be drawing 2D(later 3D) objects...the user will be able to select any edge of a polygon and move it around/modify it.. I have seen few tutorials but they were not really useful..i am still confused about how the retreived information in selection mode(Hits records) will help in performing above mentioned editing functions kindly help please suggest links/tutorials (better if in C#) thanks
Have you tried http://nehe.gamedev.net. It's in C++ but the concept is the same for selection. Here[^] is the tutorial for selection/picking. It mentions something about gluPickMatrix() so i don't know if that's the same in C#. Hope that helps.
-------------------------------- Customer in computer shop: "Can you copy the Internet onto this disk for me?"
-
Have you tried http://nehe.gamedev.net. It's in C++ but the concept is the same for selection. Here[^] is the tutorial for selection/picking. It mentions something about gluPickMatrix() so i don't know if that's the same in C#. Hope that helps.
-------------------------------- Customer in computer shop: "Can you copy the Internet onto this disk for me?"
The gamedev tutorial is definatly a good place o start. The basic concept is as follows. You have an object (say a box) give the box a bounding box or sphere. Pass the center vertex position of the box through the projection pipeline (i.e. project it onto the screen, there are opengl matrices that can do this). This will give you the coords of the object in 2d screen space. You also have to find the screen space size of your bounding area (same kind of method) once you have these you can test the mouse coords against the screen space bounding area. That isn't the best explination ever but it's somthing to start on. I'll see if I can dig out the code to project into screen coords