glGenBuffers vs glGenBuffersARB

Started by
1 comment, last by _neutrin0_ 16 years, 1 month ago
I'm currently messing around with OpenGL on various computers, and I gave the application I wrote on my laptop a try on my work computer. While I earlier tried the demo on this machine, it worked fine because I was using glGenBuffersARB. I later on switched this back to glGenBuffers(And used all non-ARB versions further). However, it now crashes with a null-pointer exception on the glGenBuffers(I'm using TAO and C# here). What's the difference between the ARB and the non-ARB version? I tried OpenGL.org, but it doesn't tell anything about glGenBuffersARB. Toolmaker

Advertisement
There is no difference apart from glGenBuffers being a core function, and glGenBuffersARB an extension function. Different names, different constants, same functionality. They are both function pointers which should be properly initialised at startup (I don't use TAO, but from glancing at the description, I'd expect that to happen automatically).
However, it is important to note that none of them is necessarily available on every system.

glGenBuffers will be available on every system that supports OpenGL 1.5 or better (VBO), but not necessarily with all targets (PBO also uses glGenBuffers, but is only available with OpenGL 2.1).

glGenBuffersARB is available if the extension string says that either the ARB vertex buffer or pixel buffer extension is present (or if both are present).
You should always check if an extension is available before using it (TAO probably has a convenient function for that).
Under 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

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 say are crashing on some computers.
glGenBuffers
glBindBuffer
glDeleteBuffer
..
..
(and so on)

So in short, to use the functions without ARB you need OpenGL version > 1.4.
++ My::Game ++

This topic is closed to new replies.

Advertisement