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 6 of 6

Thread: glVertexOffset

  1. #1
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    glVertexOffset

    To be able to specify an offset value that would be added to each index at the vertex lookup stage. This would allow a single vertex buffer to be used to render multiple objects using 16bit indices and without the need to respecify all vertex attributes using the gl***Pointer functions for each object, with all the expense that incurs.

    Simple Example Of Mechanism (not intended as an example of need):-
    Code :
    vec3f verts[]={
       {0,0,0}, {1,0,0}, {1,1,0}, {0,1,0},   // obj1 verts
       {0,0,0}, {-1,0,0}, {-1,-1,0}, {0,-1,0} // obj2 verts
    };
     
    GLushort obj1_Indices[]={0,1,2,3};
    GLint obj1_ElementOffset = 0;
     
    GLushort obj2_Indices[]={0,1,2,3};
    GLint obj2_ElementOffset = 4;
     
    glVertexPointer(3, GL_FLOAT, verts);
     
    glVertexOffset(obj1_ElementOffset);
    glDrawRangeElements(GL_QUADS, 0, 3, 4, GL_UNSIGNED_SHORT, obj1_Indices);
     
    glVertexOffset(obj2_ElementOffset);
    glDrawRangeElements(GL_QUADS, 0, 3, 4, GL_UNSIGNED_SHORT, obj2_Indices);
    Advantages and disadvantages have been discussed here:-
    http://www.opengl.org/discussion_boa...c;f=3;t=012219
    Knackered

  2. #2
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,979

    Re: glVertexOffset

    I'm for it. Actually, I've been thinking about it for a long time now :-D

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Sep 2004
    Location
    Prombaatu
    Posts
    1,401

    Re: glVertexOffset

    I'm 100% behind you, if it works out. If it doesn't, I don't know you :-)

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,052

    Re: glVertexOffset

    Jo.
    GLIM - Immediate Mode Emulation for GL3

  5. #5
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    3,032

    Re: glVertexOffset

    Well from that thread I thinked to, I ascertained that the following people are in favour of the mechanism:-

    idr - on behalf of MesaGL
    v-man
    korval
    skynet
    zeckensack
    Obli
    gmeed
    michagl
    Christian Sch?ler

    There's some experienced people in that list.
    I'm sure Angus Dorbie and jwatte would be in favour too, but they seem to have disappeared.
    Knackered

  6. #6
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,119

    Re: glVertexOffset

    Some thoughts:
    Currently we can pack multiple objects into one VB if we add proper offsets to index array.
    If objects have more than 64K vertices, then we need 32-bit indices and that's a bit of waste.
    So we use glVertexPointer but we run into performance problems.
    So current solution is to group objects that have no more than 64K vertices, use one VB for each group and add proper offsets to index array. With such approach we do not gain much by having the ability to offset vertex indices. Still, I do agree that it's more convenient and clean than adding offsets to index array.

    Another thing that I believe we should consider is OpenGL 3.0 - when new object model is introduced our performance problems with using multiple small VBO's and/or calling glVertexPointer may simply dissapear.

    My final opinion is that this extension is not that much of improvement, but if it's available I will use it.

Posting Permissions

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