Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

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

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2012
    Posts
    8

    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.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2012
    Posts
    8
    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?

  4. #4
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,264
    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.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  5. #5
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,948
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •