PDA

View Full Version : Extracting points from GL_QAUD



AeroSujan
01-18-2010, 04:17 AM
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.

V-man
01-18-2010, 03:07 PM
You should transform the vertices yourself
Normally, this is done with gluProject or whatever math lib you want. The source code of gluProject is here

http://www.opengl.org/wiki/GluProject_and_gluUnProject_code