Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: generating meshes from opengl glDraw* calls

  1. #1
    Intern Contributor
    Join Date
    Oct 2012
    Posts
    50

    generating meshes from opengl glDraw* calls

    Hi

    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.

  2. #2
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,264
    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?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  3. #3
    Member Regular Contributor Rosario Leonardi's Avatar
    Join Date
    Aug 2008
    Location
    Italy
    Posts
    354
    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.

    http://ogldev.atspace.co.uk/www/tuto...utorial28.html

    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.
    ~ ~ I tell you, realtime 3D is made of blood, sweat and screams! ~ ~

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •