# OpenGL Problem with VBOs on Windows

This topic is 3874 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

So I have a problem with a bit of OpenGL code I wrote. I've checked Google, these forums, a few FAQs etc but haven't managed to find an answer. On my iMac, VBOs just work. No problems. On my friend's Windows XP box, however, they don't. Now I have basically the following code:
GLuint vbo_id;
glGenBuffers(1, &vbo_id);
printf("inited VBO id %i\n", vbo_id);


On the Mac, this tells me that the index is 1 for the first VBO, 2 for the second, etc. I can then load data into the VBO, draw it, no problems there. On Windows, however, it says that the vbo_id is supposed to be something like -84646712, in other words, the variable hasn't been touched at all. If I initialize it to 0, it stays 0. So basically glGenBuffers() behaves just like a NOP. The most obvious explanation is of course the lack of the proper extension. On Windows, I'm using glee to help with the extension names, then the following:
if (GLEE_VERSION_1_2) printf("GL version 1.2 available\n");
if (GLEE_VERSION_1_3) printf("GL version 1.3 available\n");
if (GLEE_VERSION_1_4) printf("GL version 1.4 available\n");
if (GLEE_VERSION_1_5) printf("GL version 1.5 available\n");
if (GLEE_VERSION_2_0) printf("GL version 2.0 available\n");
if (GLEE_ARB_vertex_buffer_object) printf("vertex_buffer_object extension available\n");


The first three ifs print their stuff, which seems to tell me that the OpenGL version is 1.4; the last if reports that the vertex buffer object extension is also available. So what am I missing here? Is it just a case of bad display drivers or something like that? The most likely cause seems to be that the extension simply isn't implemented, and in the library there's just a stub like void glGenBuffers(...) {}; but I was kind of expecting it to not compile or at least crash if it isn't implemented. Maybe I'm just using it wrong? But how? Thanks in advance for any help.

##### Share on other sites
It's probably where your calling it. Does GLee have an init function?
What gfx card is on the XP?
OpenGL.org will have a document stating what GL version you need (1.5 I believe).

##### Share on other sites
OK this is something of a quirk and I had banged my head on this problem a long time ago so here goes.

In OpenGL 1.4 the vertex buffer object was an extension so it is available as an extension only i.e. GL_ARB_vertex_buffer_object (or in your case GLEE_ARB_vertex_buffer_object)

under this extension the functions for vertex buffer objects have to be appended with ARB

so they are basically
glGenBuffersARB
glBindBufferARB
glDeleteBufferARB
..
..
(and so on)

In OpenGL 1.5 they were promoted to proper OpenGL functions, ie. the ones you are using
glGenBuffers
glBindBuffer
glDeleteBuffer
..
..
(and so on)

For compatibility reasons, you can append the ARB to your code and it should work on a Machine that has GL 1.4 and the required frame buffer object extension.

##### Share on other sites
If you are on Mac these extensions will be available to you with out a extension loader. With windows you will need to get GLEE or GLEW to load the extensions or do it yourself. I can tell you using GLEE or GLEW will save you a lot of time and headaches.

##### Share on other sites
After some more hassle everything seems to work perfectly now.

On the desktop machine, replacing the 64-bit Windows XP with a normal 32-bit one gave us OpenGL up to version 2.0 (as reported by the code snippets I posted earlier). And, OpenGL 2.0 + glee = VBOs that actually work. Like I said in the first post, we're using glee, and while it did claim that the VBO extension (among other stuff) is available, VBOs still didn't work. This was with 64-bit, with glee reporting the OpenGL version as 1.4.

I'm not sure whether it was better display drivers or some more generic difference between 64-bit and 32-bit Windows that made things work, but, well, there you are. :)

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 38
• 23
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631708
• Total Posts
3001840
×