PDA

View Full Version : Extracting points from GL_QAUD



sujan.dasmahapatra
18th January 2010, 12:17
Dear Friends
I have created a mesh(grid) using opengl's GL_QUAD option using glDrawElements() check below the code

/////////////////////////////////////////////////////////////
GLuint list = glGenLists(1);
glNewList(list, GL_COMPILE);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
glNewList(list, GL_COMPILE);
glDrawElements(GL_QUADS, ptsInBlock*ptsInBlock*blocks*4, GL_UNSIGNED_INT, indices);
glEndList();
glDisableClientState(GL_VERTEX_ARRAY);
//////////////////////////////////////////////////////////////

Now I can see the elements on the screen. I want to do some operations on these elements so I need the information about each of these elements, i.e, I need the all 4 points coordinates for each of these elements.How can I retrive each element and all points coordinates.

Any idea would be highly appreciated.[/B]

axeljaeger
19th January 2010, 22:38
If you want the coordinates of the points before they are projected on the screen, grab a copy of the "vertices"-array. If you want the projected coordinates on the screen, see http://nehe.gamedev.net/data/articles/article.asp?article=13