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: Interleaved VBO noob question

  1. #1
    Intern Newbie
    Join Date
    Mar 2009
    Posts
    45

    Interleaved VBO noob question

    I got VBO to work with a different array for vertex positions, normals, texture cordinates and an index array.
    Now I'm trying to use an interleaved VBO with the position, normals and texture coords and the separated index array.
    I've read something about using blocks of 32 bytes to store all the vertex atributes in the array, so (tell me if I'm wrong) I store the attributes this way:
    "PPPNNNTT" (where P stands for position, N for normals and T for tex coords)

    If they are all floats of 4bytes, then summed up I have 32 bytes.

    But I don't know well how to use gl**Pointer() to specify where each attribute is.
    I'm doing something like this:
    Code :
    ...
    glVertexPointer(3, GL_FLOAT, 20, 0);
    glNormalPointer(GL_FLOAT, 20,12);
    glTexCoordPointer(2, GL_FLOAT, 24, 24);
    ...
    But I think the last two arguments of the functions don't expect bytes, can anyone help me out with this?
    Thanks

  2. #2
    Intern Newbie
    Join Date
    May 2007
    Location
    China
    Posts
    35

    Re: Interleaved VBO noob question

    in this way :
    Code :
    int size = 32;
    glVertexPointer( 3, GL_FLOAT, size, (char *)NULL + 0 );
    glNormalPointer( GL_FLOAT, size, (char *)NULL + 12 );
    glTexCoordPointer( 2, GL_FLOAT, size, (char *)NULL + 24 );

  3. #3
    Intern Newbie
    Join Date
    Mar 2009
    Posts
    45

    Re: Interleaved VBO noob question

    Thanks man =)

Posting Permissions

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