View Full Version : generating meshes from opengl glDraw* calls

10-07-2012, 09:28 AM

is there a way to store the generated mesh from a glDraw* call?

I have seen a mesh full of vertices and vertex information stuffed in VBOs and then rendered out with the glDrawArrays() call.

But can I store the drawn result from the glDrawArrays as a new mesh? The thing i am expecting to get after the glDrawArrays() call are interpolated vertices. so in a sense i have a denser mesh than the one i started out with - i.e. in the beginning, I just had the vertices that were used by glDrawArrays to create the 3d object.

10-07-2012, 12:24 PM
glDrawArrays doesn't generate a mesh. The mesh information is in the VBO. Interpolation takes place on the GPU, between the vertex and fragment shader. I suppose you can take the position information at the fragment shader level and output the value to some render buffer (RGBA32F), but that is not mesh information.
Perhaps what you want is gluProject to transform your vertices to window space? Or eye space? Or clip space?

Rosario Leonardi
10-08-2012, 12:18 PM
If your vertex shader is doing some vertex animation (bending, skinning or waving) or you have a geometry shader that add vertex or you are using a tessellation shader you can read the vertex with transform feedback.


If you are not doing anything of the above.. then.. well you can read the data with transform feedback, but you will read the same data you have send, and that's embarrassing.