Jump to content
  • Advertisement
Sign in to follow this  
Jaete

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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.

Hope that solves your problem.

Share this post


Link to post
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 this post


Link to post
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. :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!