Jump to content
  • Advertisement
Sign in to follow this  
ebody

CAD like pick/select + hover effect, how?

This topic is 3855 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

I've some questions about pick/select and hover effects: 1: If I want to be able to select any object in the scene, like in some CAD app, how do I interact with them? do I have to give everything a name with glPushName()? 2: To make a hover effect, for example to draw a thicker line, what method would be the best for it? ray picking? or something else? 3: What do I need to make a ray picking? - a light source? - how should the light source be? - what elese do I need for that? - how do I recognize which object was clicked in this method? (I suppose the selection mode have nothing to do with it) If there's something I miss, please let me know... I didn't do much picking yet and I'm sure I forget something important... I do not expect any code but just clues, for example to do this and that read about these... methods/functions etc. or you will need this and that...

Share this post


Link to post
Share on other sites
Advertisement
Well I have never seen a good treatment of this subject (writing 3D editors/modellers) so I just came up with my own solutions to these problems:
OpenGL feedback can work, its just ugly to implement. I used that in my first 3D editor.
In the second one I decided to do the calculation myself: when the user stops transforming the camera in a particular view I kick off a thread which projects the 2D positions of vertices/objects, then use these 2D screen positions for selection. Also if you have some sort of BSP or other space partioning then you can use your own ray intersect routines for polygon selection.
The 'hover' effect (I assume you mean, when the user moves the mouse over an object it is highlighted) just implements the same techniques but in real time. That is more tricky!
Another method I have tried is using occlusion queries coupled with the OpenGL pick-matrix method, so I create a pick matrix around the mouse location then draw the scene using occlusion queries on each object. If any pixels are drawn then the object is under the mouse position. This requires front to back rendering I guess, I didn't spend long experimenting with it.
Another method is using a different colour for each element then you can simply read the colour from the back buffer under the mouse position and that will give you your selected object.
HTH!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!