Skip to content

Pick vertex/facet/cell under the cursor #88

Answered by BrunoLevy
sebmestrallet asked this question in Q&A
Discussion options

You must be logged in to vote

Graphite's picking works as follows (and all basic functionalities are implemented in Geogram, I confirm):

  1. draw the mesh with color-coded element ids (depending on whether you want to pick points/edges/facets/cells, the elements you want to pick are drawn with color-coded ids, all the rest is drawn in white / 0xffffff color).
  2. read the id of the picked element using glReadPixels
  3. unproject the picked point to get its 3D location

For 1), MeshGfx in geogram_gfx/mesh/mesh_gfx.h has a set_picking_mode function (to draw an image with element IDs instead of standard rendering), and you can chose the type of elements you want to pick. Just do that in the back buffer without calling SwapBuffers (…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@sebmestrallet
Comment options

@sebmestrallet
Comment options

@BrunoLevy
Comment options

@sebmestrallet
Comment options

Answer selected by sebmestrallet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants