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):-

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_boards/ubb/ultimatebb.php?ubb=get_topic;f=3;t=012219

I’m for it. Actually, I’ve been thinking about it for a long time now :smiley:

I’m 100% behind you, if it works out. If it doesn’t, I don’t know you :slight_smile:

Jo.

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.

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.