I use OpenGL show OpenMesh 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
1 reply to this topic
Sponsor:
#2 Members - Reputation: 1408
Posted 11 December 2012 - 06:04 AM
I think you need to use color picking. That is, you draw your objects in a unique color for each object. Don't show the result, but read out the color at the screen coordinate of the mouse. That color will then identify what object is behind the mouse.
You will probably need three different modes, for vertices edges and faces. For vertices, it may be an idea to draw small quads instead of dots, making it easier to hit them with the mouse. For edges, you can draw wide lines.
Do you want continuous detection of the object behind the mouse, or only when the user clicks with the mouse? Continuous detection can lead to performance problems.
You will probably need three different modes, for vertices edges and faces. For vertices, it may be an idea to draw small quads instead of dots, making it easier to hit them with the mouse. For edges, you can draw wide lines.
Do you want continuous detection of the object behind the mouse, or only when the user clicks with the mouse? Continuous detection can lead to performance problems.






