View Full Version : Why are extensions available as function pointers?
02-28-2012, 12:12 PM
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?
02-28-2012, 12:16 PM
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.
02-28-2012, 02:35 PM
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).
02-29-2012, 11:38 AM
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.
03-01-2012, 11:20 AM
thanks, I now realize what I asked and what you wrote in the post.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.