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: Why are extensions available as function pointers?

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    8

    Why are extensions available as function pointers?

    Im new and Im interested to know why are the opengl extensions available as function pointer and not as some c style API or as some exported class?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    May 2009
    Posts
    4,728

    Re: Why are extensions available as function pointers?

    Well, function pointers are a "c style API". I don't really understand what you're trying to say there. And they don't use an "exported class" because OpenGL is a C API. An "exported class" would by definition not be C.

  3. #3
    Member Regular Contributor
    Join Date
    Apr 2007
    Posts
    271

    Re: Why are extensions available as function pointers?

    Because the availability of the extensions depends on the combination of the driver version and GPU capabilities.

    They have to be discovered *dynamically* (ie at runtime) by any program that wants to use them. If an extension is advertised by the driver (ie if the extension exists in the string returned by glGetString(GL_EXTENSIONS) ), then the functions defined by this specific extension exists and you can retrieve their pointers by a call to a wgl-specific or glx-specific or mac-specific flavor of getprocaddress() (which the glew lib can hide for you).

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    8

    Re: Why are extensions available as function pointers?

    Thanks Overlay, now I understand.

    Alfonse, Thanks for the reply. I wanted to understand why these extensions are available as function pointers and not as some functions/classes which can be in a Dll or something.

    thanks.

  5. #5
    Junior Member Newbie
    Join Date
    Nov 2011
    Posts
    8

    Re: Why are extensions available as function pointers?

    Alfonse,

    thanks, I now realize what I asked and what you wrote in the post.

    thanks again.

Posting Permissions

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