Skip to main content
gamedev.net
🔒 Locked

Selection

Started by Cacks Jan 30, 2006 at 8:03 AM 0 replies 600+ views
Original Post
Cacks
Cacks
Hi guys, I'm making a modelling program. I asked about selection a bit back. Some1 suggested selection by unique colour IDs. I want to make shapes from NURBS, so that might not be an appropriate way to do it. I'm wondering if I use openGL selection can I select object vertices? I'll need to be able to do this in order to manipulate the objects. Thanks for any help given!
Reject the basic asumption of civialisation especially the importance of material possessions
Libe
Libe
Hi,

you have different options to implement picking in your modeler. Basically you'll want to select objects, faces, points and lines.

To select objects a common and easy to way to do it is to use glReadPixels: for each object you assign a different single color and then you read the pixel's color you have under the mouse click:
Good link

To select faces, you could use the OpenGL selection, (which on some implementations runs in software mode and it's not very fast):
Good link
A better approach is to do 3D picking: basically you shoot a ray in your world to select the faces that return a hit (ray/polygon intersection test). 3D picking can be a little longer to implement but, if it's associated with some kind of culling technique (to reduce intersection test), can be a lot faster than OpenGL selection.

Once you get used to pick faces, it's simple to pick points: if you use 3D picking, once you get the face that hit, you could project the hit point on the near plane among with the other face's point and select the one with min distance. Same for edge.

Here's a pretty good overview of the techniques above:
3dkingdoms
TomC

Have fun!

Libe

Libero Spagnolini

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.