Nick_Miller

06-22-2012, 10:14 PM

Hi, I was hoping to learn how I can use pick selection on individual points or lines. The method of selection I wanted to do this with is rendering the geometry with the render mode: GL_SELECT, then retrieving the picked names using the select buffer.

I really wanted to do this with Vertex Buffer Objects, but after some reading, that seemed like a bad idea. I still don't want to go back to picking using

glBegin() and glEnd() pairs though.

So, I wanted to know if there was a way I could do pick-selection for triangles, points, and lines using different methods of rendering, such as: Display Lists or using glDrawElements(). The latter being most desirable.

The way I intended to implement this is as follows:

I wanted to create a simple modeling program; one where I can select a vertex on a mesh, use some translation functions, and continue to draw the mesh with the new vertex position. This mesh would be divided into individual triangles.

Using glDrawElements(), I wanted to create an array that holds each vertex in the mesh. Vertices would not repeat, so each value in the array would be unique. Then I wanted to use an index array to tell the GPU how to use the vertices. I was hoping to draw the mesh using GL_TRIANGLES as the type of geometry. So therefore, every three elements in the index array specifies one triangle by pointing to 3 different vertices stored in the vertex array.

When pick-selecting a vertex in the mesh and performing translations on it, the vertex array would be updated with the new value of the modified vertex. In doing so, some triangles in the mesh will change their orientations to use the new vertex value.

The same procedure would occur for selecting a line or a whole triangle, 2 vertex values would change for the line, and 3 for the triangle.

If you can post any information relevant to helping me with this, that would be greatly appreciated.

Thanks in advance!

Nick

I really wanted to do this with Vertex Buffer Objects, but after some reading, that seemed like a bad idea. I still don't want to go back to picking using

glBegin() and glEnd() pairs though.

So, I wanted to know if there was a way I could do pick-selection for triangles, points, and lines using different methods of rendering, such as: Display Lists or using glDrawElements(). The latter being most desirable.

The way I intended to implement this is as follows:

I wanted to create a simple modeling program; one where I can select a vertex on a mesh, use some translation functions, and continue to draw the mesh with the new vertex position. This mesh would be divided into individual triangles.

Using glDrawElements(), I wanted to create an array that holds each vertex in the mesh. Vertices would not repeat, so each value in the array would be unique. Then I wanted to use an index array to tell the GPU how to use the vertices. I was hoping to draw the mesh using GL_TRIANGLES as the type of geometry. So therefore, every three elements in the index array specifies one triangle by pointing to 3 different vertices stored in the vertex array.

When pick-selecting a vertex in the mesh and performing translations on it, the vertex array would be updated with the new value of the modified vertex. In doing so, some triangles in the mesh will change their orientations to use the new vertex value.

The same procedure would occur for selecting a line or a whole triangle, 2 vertex values would change for the line, and 3 for the triangle.

If you can post any information relevant to helping me with this, that would be greatly appreciated.

Thanks in advance!

Nick