ARBvbo NV17 (Linux)


I’ve just downloaded the latest NVIDIA drivers for Linux (IA32) and to say the least I’m very impressed that this release supports full OpenGL1.4 and even more impressed that ARB_vertex_buffer_object is already supported.

But I’ve come into a problem using ARBvbo (on a GeForce4 MX 440, if it matters), where the “traditional” vertex arrays render everything perfectly.

Here is the piece of code :

void render(const Mesh& mesh)
static bool first = true;
static GLubyte* data;

if (first) {

    unsigned int vertex_offset = 0;
    unsigned int vertex_bytes = 4*sizeof(GLfloat)* mesh.getVertexCount();
    unsigned int color_offset = vertex_offset + vertex_bytes;
    unsigned int color_bytes = 4*sizeof(GLfloat)* mesh.getColorCount();
    unsigned int last_offset = color_offset + color_bytes;

    data = (GLubyte*)malloc(last_offset);
    if (mesh.getVertexCount() > 0) memcpy(data+vertex_offset, mesh.getVertex(0).ptr(), vertex_bytes);
    if (mesh.getColorCount() > 0) memcpy(data+color_offset, mesh.getColor(0).ptr(), color_bytes);

// Create buffer object

    // Initialize data store of buffer object
    glBufferDataARB(GL_ARRAY_BUFFER_ARB, last_offset, data, GL_STATIC_DRAW_ARB);

    data = NULL;


    glVertexPointer(4, GL_FLOAT, 0, (void*)(data+vertex_offset));
    glColorPointer(4, GL_FLOAT, 0, (void*)(data+color_offset));

    printf("Buffer object initialized %d bytes

", last_offset);
printf("glGetError returned %d
", glGetError());


(unsigned int i = 0 ; i < mesh.numPrimitives() ; i++)
(unsigned int j = 0; j < mesh.vpp() ; j++)



If I don’t define USE_BUFFER_OBJECTS, everything is rendered correctly at 120 fps ; and if USE_BUFFER_OBJECTS is defined, nothing appears and the fps drops to 18 fps.

I roughly copy’n’pasted the example in the spec, so I can’t really see what’s wrong assuming the example is right.

In a first program, I only sent the vertex coordinates in a buffer object (color was in the reserved buffer object 0) and it worked fine apart from the decreased performance (30fps instead of 120fps). Aren’t vertex buffer objects accelerated on GeForce4MX cards ?

The data contains 640,000 bytes and I reduced the size to 6,400 but nothing was better.

I don’t think it can be an alignment problem since I’m working on a pentium and every data type is GL_FLOAT (for vertices as well as colors).

I call glGetError which obviously returned GL_NO_ERROR otherwise I wouldn’t post this thread !

Thanks in advance

Originally posted by vincoof:


    glVertexPointer(4, GL_FLOAT, 0, (void*)(data+vertex_offset));
    glColorPointer(4, GL_FLOAT, 0, (void*)(data+color_offset));


This code is incorrect. When you are using VBO, the addresses for *Pointer need to be zero-based (in other words, an offset instead of a pointer). Try replacing data with (char *)NULL.

when USE_BUFFER_OBJECTS is enabled, data is set to NULL, so the following really gives an offset :

Originally posted by vincoof:
when USE_BUFFER_OBJECTS is enabled, data is set to NULL, so the following really gives an offset :

Whoops, I missed that part.

I added VBO to a program yesterday, and the only differences in API usage between that and this are that I used glGenBuffersARB and glDrawRangeElements / glDrawArrays, and the vertex data was interleaved. I did not notice any performance drops when using VBO.

I have a GF4 Ti4600.

Finally, I figured it out and I have to say either I’m mis-reading or the spec or there is a bug in the implementation.

I tried NOT to delete the array (and not set it to null) and it works. In other words, I’m not sending an “offset”, I’m still sending a pointer, even though I’m using vertex buffer objects.

No hype, using more than one buffer does not work. The program displays nothing, and after 1-2 seconds it suddenly stops with the message “Aborted” which I do not know at all where it comes from (I never displays such message).

I can send a simple program with source code if anyone is interested.

Please send and I’ll file a bug on this.

Thanks alot. I’ve sent an email with the corresponding zip file, assuming your email address is the one in your profile.

I’ve looked a bit further in the problem and it seems that :
(i) more that one vertex buffer object is NOT allowed, and
(ii) it’s not possible to send an offset to glDrawElements, eg glDrawElements(GL_TRIANGLE_STRIP, n, GL_UNISGNED_INT, (GLvoid*)0) does NOT work, I must call glDrawElements(GL_TRIANGLE_STRIP, n, GL_UNISGNED_INT, (GLvoid*)index_array)

(all of that information is already written in the README of the zip file).

[edit: I think the 2nd point is my fault. I use GL_ARRAY_BUFFER_ARB instead of GL_ELEMENT_ARRAY_BUFFER_ARB. Still the first point is a problem]

[reedit: I tried with GL_ELEMENT_BUFFER_ARRAY_ARB for the index array and it still does not work, so the 2nd point is still a problem]

[This message has been edited by vincoof (edited 04-03-2003).]

Ok I’ve overcome on the GL_ELEMENT_ARRAY_BUFFER_ARB problem, but other occur.
I’ll post the update.

Please, what is wrong with that :

glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertex_buffer);


glVertexPointer(2, GL_FLOAT, 0, vertex_array);


/* Index array

glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, index_buffer);

/* Rendering
glDrawElements(GL_TRIANGLE_STRIP, n, GL_UNSIGNED_INT, index_array);

/* Restoring state

It isn’t working. (nothing shows, and program aborts after ~1 second).
But if I insert those lines after glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0) :

/* Color array

glColorPointer (3, GL_FLOAT, 0, color_array);

everything works fine. (colors are not in a vertex buffer object)

I am having problems with vbo in Linux, too (driver 4348).
For details please read the thread ‘ARB_VBO in pascal’.