snap objects in OpenGL ?

How do the program know about the points or planes that we need to select them by mouse?

thank you

The program doesn’t know unless you code it in. If you have already implemented mouse selection of objects that you render then you can re-use the selection methods to programmatically “snap” the object to any point when the mouse button is released.

You can optimise the speed by only allowing specific objects to snap together. For example, objects that I render have certain control points that I can select and drag around. So, no matter what kind of object I am working with I only need to render the control points with my selection method to see if I need to snap to anything nearby.

ok?

Matthew

I just read your post again. The topic isn’t directly related to the question that you asked in the post.

Do you want to know about selection or snapping?

To snap, you can re-use the tools that you use for selection. Selection itself is a bit harder. Which is it that you want to know about?

matthew?

Thank you very much for your suggestions.
I would like to create an application that has the “snapping” like Sketch UP Program. I hope that you have ever seen that program before.
If I have 2 WireCubes (small one is in the big one) when I move the small one , I need the snapping active for help me locate any the coner of the small cube attach into big one at the coner or the edge too .
please help me again. thanks a lot