What OpenGL version do I target? Should I use extension loading libraries?

Hello, I recently started looking into OpenGL and I was wondering what version of OpenGL I should target? I’m guessing that you should provide compatibility with older versions and such, but how “far back” should I go? I’ve been looking up these extension loading libraries but I was wondering if it’s possible to accomplish reasonable compatibility without these. The specifications for each version of OpenGL is quite a read and because of my limited knowledge of working with OpenGL I could not possible grasp all of the content and make a decision on my earlier question.

If I were to write my own, do I need to check for each version of OpenGL available and make adjustments during runtime to what functions my application uses? Are there a lot of functions that I will not (normally) use which are added in the later versions of OpenGL, can I disregard these?

Note: I figured I would bite the bullet and learn this kind of tedious stuff earlier than have problems later, so please, tell me all the work required to accomplish this.

Help is very much appreciated and if my terminology is off, please excuse me.

Should I use extension loading libraries?

Yes.

Hello, I recently started looking into OpenGL and I was wondering what version of OpenGL I should target? I’m guessing that you should provide compatibility with older versions and such, but how “far back” should I go?

That’s up to you. The Steam hardware survey is a nice beginning point for estimating the availability of hardware on consumer machines.

Only NVIDIA still supports their GL 2.1 (ie: DX9) hardware, and I wouldn’t trust ATI’s GL 2.1 drivers with any GLSL code if you want your code to actually work. Intel’s also a problem in this regard.

If I were to write my own, do I need to check for each version of OpenGL available and make adjustments during runtime to what functions my application uses?

That’s up to you and your code, and it has nothing to do with how you load your functions. Detecting version/extension availability and modifying your code accordingly is all about how you want to render stuff. If you want to use a 3.3 feature, then you check for the 3.3 version and use the feature if it’s there.

Thanks for the quick response.

Follow-up question: How do I pick the right extension loading library? I noticed there are a few and I’m not really sure which one I should use or which ones would fit me best. Are they different in some fundamental way? Any article covering this?

http://www.opengl.org/wiki/OpenGL_Loading_Library

Use GLEW for all versions. For GL 3.2 and above, it has a minor issue.
For GL 3 and 4, there is GL3W.

They all basically do the same thing : Get the function pointers. It isn’t something to think much about.

They all basically do the same thing

Except they don’t. GL3W doesn’t load (non-core) extension functions, just core OpenGL API functions. And since glcorearb.h doesn’t include useful things like EXT_texture_anisotropic_filtering and the like, it’s not enough.

GLEW has no provisions for removing removed GL functionality, so it shoves everything at you, even functions you shouldn’t call.

GL Load (which I wrote, BTW) handles both of these cases. It has headers that provide only core GL +extensions (no compatibility stuff), and it loads extensions as well as the core functions.

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