View Full Version : avaibility of opengl extension

08-05-2003, 11:53 PM
How can I test if an opengl extension is available on the video card ?

08-05-2003, 11:59 PM

08-06-2003, 12:40 AM
Originally posted by roffe:

I've already read this, but I didn't find what I want : I know how to use extensions, but I want a fonction to test if a particular extension is available, to prevent for use it if it isn't supported by the hardware...

08-06-2003, 12:55 AM
Originally posted by Acheum:
I know how to use extensions, but I want a fonction to test if a particular extension is available

Is this a joke? You say you know how to use extensions, but you don't know how to check if an extension is supported. The link I gave you points to source code for extension checking.

08-06-2003, 01:29 AM
nehe.gamedev.net has a tutorial on how to do that (Lesson 24).


08-06-2003, 02:45 AM
Oups sorry, I didn't read very well...

#include <GL/gl.h>
#include <string.h>

isExtensionSupported(const char *extension)
const GLubyte *extensions = NULL;
const GLubyte *start;
GLubyte *where, *terminator;

/* Extension names should not have spaces. */
where = (GLubyte *) strchr(extension, ' ');
if (where &amp;#0124; &amp;#0124; *extension == '\0')
return 0;
extensions = glGetString(GL_EXTENSIONS);
/* It takes a bit of care to be fool-proof about parsing the
OpenGL extensions string. Don't be fooled by sub-strings,
etc. */
start = extensions;
for (; http://www.opengl.org/discussion_boards/ubb/wink.gif {
where = (GLubyte *) strstr((const char *) start, extension);
if (!where)
terminator = where + strlen(extension);
if (where == start &amp;#0124; &amp;#0124; *(where - 1) == ' ')
if (*terminator == ' ' &amp;#0124; &amp;#0124; *terminator == '\0')
return 1;
start = terminator;
return 0;

08-06-2003, 02:45 AM
to kwow if a particular extension is supported (for example GL_ARB_fragment_program), do:

char *ext_string = glGetString(EXTENSIONS);
if (strstr(ext_string, "GL_ARB_fragment_program") != NULL)
// the extension is supported
// the extension is not supported

08-07-2003, 08:28 AM

ext_string, "GL_ARB_fragment_program")

*AARRGHH*, there is a paper of nvidia, somewhere out there, where is told that a developer should "avoid the use of strstr(...) because it results in som inexplicably bugs.

08-07-2003, 03:02 PM
There is also a tool.
Check this site!! http://www.realtech-vr.com/glview/

08-08-2003, 01:51 AM
But some drivers don't "refresh" extensions string always. For example there is no VBO extension in ext. string with nVidia detonator < 44.03. Best way is to call wglGetProcAddress and check whether it is NULL or not...

08-08-2003, 02:39 AM
They didnt expose them becourse you shouldnt depend on that extension to work in those drivers, it was intended for developers to test it, not use it in a real app, so i dont think they forgot to update the extensionstring.