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 7 of 7

Thread: LoadGL.h

Threaded View

  1. #1
    Junior Member Regular Contributor
    Join Date
    Dec 2010
    Location
    Oakville, ON, CA
    Posts
    107

    LoadGL.h

    Here is a single header file one need to include to get hands on ALL OpenGL functionality from the very first version and up to the current:

    LoadGL.h

    The great simplification this header brings with it is an automatic function pointer initialization. User does not need to bother to initialize the function pointers manually. All known core function version pointers are declared in the LoadGL.h and each of them points to the corresponding loading function at program initialization. First time the function is called, it's loader automatically searches for an entry point, mangles the pointer so that it points to that address, then calls it with the given arguments. After that the pointer points directly to the OpenGL function (if present; otherwise call has no effect). Simple magic.

    Be aware though, that the rendering context which has been set current when the function was called first time must be active all subsequent function call times, so it is not allowed to use the pointers with the rendering context different from what was bound first time the function was called.

    So all you need to do in order to use any of the OpenGL function you have seen in the reference pages, is to place the LoadGL.h file into the directory with your project and include it:
    Code :
    #include "LoadGL.h"
    After that you can call any of the OpenGL functions (make sure the rendering context created, though). As simple as that. Of course, it is always a good practice to check if the given extension is available, but if it isn't, call to unsupported function will be just ignored.

    It is a time consuming work to update the header with each new version of OpenGL being published, but the header served me well for years, so I keep it updated and feel like sharing right now. So feel free to use it and let me know if there is anything more you would like to see in it.
    Last edited by Yandersen; 07-04-2014 at 07:49 AM.

Tags for this Thread

Posting Permissions

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