Results 1 to 2 of 2

Thread: Transformations on VBOs

  1. #1
    Junior Member
    Join Date
    Jun 2009

    Transformations on VBOs

    I'm currently trying to perform transformations on vertex data stored in a VBO. I'm storing vertex data representing multiple meshes in a single VBO, and then attempting to apply separate transformations (glRotatef, glTranslate, etc) between glDrawArray calls. This is not working as expected, in fact, both meshes are simply rendering on top of each other and all the transformations are applying to all the glDrawArray calls. Any guidance on the solution to this would be awesome.
    Code :
    // Bind the buffer object, this is storing mesh 1 and mesh 2 vertex data
    glBindBuffer(GL_ARRAY_BUFFER, mFBO);
    // Transform mesh 1
    glRotatef(0.5f, 1.0f, 1.0f, 0.0f);
    glColorPointer(4, GL_UNSIGNED_BYTE, 0, 0);
    glVertexPointer(4, GL_FLOAT, 0, mesh1VertexOffset);
    // Commit mesh 1 data (0 -> mesh 1 index length)
    glDrawArrays(GL_TRIANGLES, 0, mesh1IndicesLen);
    // Transform mesh 2
    glTranslatef(0.002f, 0.0f, 0.0f);
    glColorPointer(4, GL_UNSIGNED_BYTE, 0, mesh2ColorOffset);
    glVertexPointer(4, GL_FLOAT, 0, mesh1VertexOffset + mesh2ColorOffset);
    // Commit mesh 2 data (mesh 1 index length -> mesh 2 index length)
    glDrawArrays(GL_TRIANGLES, mesh1IndicesLen, mesh2IndicesLen);

  2. #2
    Junior Member
    Join Date
    Jun 2009

    Re: Transformations on VBOs [SOLVED]

    Solved the issue. This can be achieved using glPushMatrix() and glPopMatrix(), which I was doing but improperly within the context of VBOs

Similar Threads

  1. ES2 and VBOs
    By birdcage in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 2
    Last Post: 01-04-2011, 11:25 AM
  2. color transformations - problem with alpha
    By sochm in forum OpenVG and VGU
    Replies: 3
    Last Post: 04-24-2009, 07:59 AM

Posting Permissions

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