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

Thread: Why does one need to wrangle extensions for the opengl functions?

  1. #1
    Junior Member Newbie
    Join Date
    May 2013
    Posts
    17

    Why does one need to wrangle extensions for the opengl functions?

    Hi. Beginner here. I do not understand why one has to wrangle extensions for opengl functions like glDisable etc... on windows and linux platforms (I think mac is an exception). If you are building a hello world application you would first create the OpenGL context, create the window, and then wrangle the extensions using GLEW or manually. But why do you have to "wrangle" these extensions? Are there not bindings for the gl functions in the header files that come with the Visual Studio and linux development environments? Do not those gl functions have definitions in the device drivers that are installed in the OS for a particular gpu?

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    474
    On Windows, opengl32.dll only exports the functions which are part of the OpenGL 1.1 API. For anything else, you need to use wglGetProcAddress() (or a higher-level library such as GLEW).

    On Linux, libGL.so is updated regularly with new functions, but the driver (for direct rendering) or the X server (for indirect rendering) may support additional functions beyond those exported by the library.

    In either case, the library is just a conduit between the application and the driver (or the X server). The application may be able to use newer functions, but still work without them. If it referenced the function directly, it would fail to work (or even load) if the OpenGL library was out of date, even if the driver supported the function or if the application could work without it.

    By querying the function at run-time, this issue is avoided.

    Also, some functions may only be available in certain contexts. E.g. on a system with multiple video cards, each card may support a different set of functions (particularly extensions, which are often vendor-specific). And a single card may support different functions depending upon whether you're using a compatibility profile or core profile context.

Posting Permissions

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