Jump to content
  • Advertisement
Sign in to follow this  
xlvector

OpenGL How can I select vertex,edge,face of a mesh

This topic is 4611 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 use OpenGL show mesh in a window and I want to use mouse to select some vertices,edges or faces of mesh and I only want to select vertex,edge,face which I can see in viewport how can I do that only using OpenGL. the mesh may have more than 10000 vertices

Share this post


Link to post
Share on other sites
Advertisement
First build the system to capture a mouse click (movement, anything you want to act on). After that you need to get the position of the point clicked at. Then you can use gluUnproject() to attain the 2 positions in world space that form the line from front to back where clicked.

You must know that vertices and lines are in princible infinitly small, so selecting them will go directly. You need to think about a system that returns a list of lines or vertices that are near or on the clickline. You must also specify whether you want to select the line or vertex closest to the Eye of the camera or not.

The finish touch should be to use a different color when drawing the selected line or vertex.

These are the basic steps to take, I cannot supply code snippets, because the would never apply to your system.

I hope the help bit.

Regards,

Xeile

EDIT:

PS: The keyword for this topic is 'Picking' if you want to lookup more about it.

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!