I am working on a project that I need to select two vertices of a mesh and calculate the shortest path between them. I am using GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER for binding the OpenGL buffers and draw them by glDrawElements.
Finding the shortest path is not an issue here. The issue is in vertex selection. I need to select the vertices by mouse click and store their ID for further process. I have some functions that return the mouse position, but I couldn't find a method that could get the vertex ID or triangle ID.
I also found about rayPicking methods, but that one is used for selecting the mesh itself rather than an element of it.
I appreciate any help or idea
Update: The meshes that I have to deal with, have high number of vertices and triangles, so methods such as applying unique color to each vertex is not a proper solution. Also adding a sphere to each vertex or triangle and calculate the intersection point of the ray with sphere doesn't sound proper way either.