Opengl extensions on windows best practices

Hi,

We are building an opengl application on windows using glew 2.1 to load extensions. I have some questions about best practices here since there are different options available for the functions I want to call and I don’t really understand the differences.

For example to use VBOs I have the option of checking the glew flag GLEW_VERSION_1_5 and then using the functions glGenBuffers, glBindBuffer, glBufferData. Or I could check the flag GLEW_ARB_vertex_buffer_object and use the functions glGenBuffersARB etc. I’d like to know if there is any reason in practice to prefer one to the other, it sounds like in principle that the ARB functions could be available when the non-ARB are not, in which case is there any downside to just using the ARB version? And is it correct that the reverse scenario is not possible?

We also need to use GLSL, and here I have basically the same choice between checking for GLEW_VERSION_2_0 and using non ARB, and checking GLEW_ARB_shader_objects and using ARB.

We also need to use FBOs and here I get particularly confused. The fbo functions like glBindFramebuffer etc in the glew main header file are not organised under an opengl version but instead appear under the flag GLEW_ARB_framebuffer_object. Despite this they don’t seem to have an ARB version but they do have an EXT version, the EXT versions appear with the flag GLEW_EXT_framebuffer_object. Although interestingly glew supplies two separate flags for the multisampling EXT functions glBlitFramebufferEXT and glRenderbufferStorageMultisampleEXT.

I was looking at some popular open source libraries like Ogre3D and Horde3D and I noticed that for FBOs specifically they do seem to favour the EXT versions. Ogre also uses the ARB versions of VBO and GLSL functions but Horde doesn’t. At the moment I am leaning towards just following the Ogre approach. It’s possible that it doesn’t make much difference these days, but the software does need to run on cheap intel graphics so I’m not sure.

Thanks for any help.

The official word on ARB extensions from the GL 1.2 specification when they were originally introduced, is:

These extensions are not required to be supported by a conformant OpenGL implementation,
but are expected to be widely available; they define functionality that is likely to move in to the required feature set in a future revision of the specification.

In other words, a conformant OpenGL 1.5 or higher implementation is not required to support the GL_ARB_vertex_buffer_object extension, and this is the case irrespective of operating system.

Regarding GL_ARB_shader_objects, this is NOT the same as the OpenGL 2.0 shader/GLSL functionality. GL_ARB_shader_objects was never promoted to core GL, has undefined interactions with more recent GL functionality, and should not be used unless you absolutely must target really old hardware that does not support OpenGL 2.0. Bear in mind that such hardware is by now 15 to 20 years old, and consider if you even want to support it in your program.

Likewise there are differences between the GL_EXT_framebuffer_object extension and the core GL 2.1 framebuffer object functionality: the extension version was not just simply promoted.

For your target hardware, even current cheap Intel graphics supports OpenGL 4.6, and you need to go back to the Intel GMA950 - from about 2006 - for the most recent Intel that doesn’t support at least OpenGL 2.1. Again consider if you even want to support these computers, bearing in mind that they’re also likely to be running out-of-date, unpatched operating systems, the rest of the hardware is going to be very poor, and your program will likely run badly on them anyway.

Your options therefore seem to boil down to:

  • Support the core GL item where it’s available.
  • If you’re satisfied that the core GL item is identical to the extension version (check the GLenum defines and the function pointers) then you can support both through a single codepath.
  • Support both through two different codepaths if they’re not the same.
  • Use the extension version only with the caveat that it may not be available on all implementations, even if core is available.
1 Like

Ok that’s good information, thank you.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.