GL Extensions under Linux / Solaris


Right, extensions under win32 are done with a few basic steps.

  1. Declare function style.
  2. Declare function pointers.
  3. Get function address with wglGetProcAddress.

How are extensions gotten under Linux and Solaris. Obviously I can’t use wglGetProcAddress. What is the quivelent under the other OS’s, and what header file are they in?

I looked at nehe’s linux port of multi-texturing, but could not find anything about getting extension addresses in it. Are certain extensions automatically supported in Linux, i.e. what current version of OpenGL is it running.

Basically I’m trying to make my demos platform independant. To do that I need to know how to get extension information under different OS’s.



hey there

this is just a little snippet of code that will give u some ideas how its done… do a ‘man dlopen’ for more specifics on the dlopen function

#include <dlfcn.h>

void *dlHandle;
int (*fnPtr)();

// open the shared library…

if ((dlHandle = dlopen("/usr/lib/", RTLD_LAZY | RTLD_GLOBAL)==NULL)){
printf("Could not open shared object file

// set the function pointer

fnPtr = dlsym(dlHandle, “myFunc”);


works pretty much exactly like wglGetProcAddress.

[This message has been edited by rts (edited 04-10-2001).]

Can’t do a ‘man dlopen’ cos I aint got Linux/Solaris.

What header file is glXGetProcAddressARB in rts?

Can you give me the function definition of it as well, as I dont have access to any linux docs/headers.




extern void (*glXGetProcAddressARB(const GLubyte *procName))( void );

More info available here:

Scroll down to section 3.6

Hope this helps.

The following is an excerpt from TuxRacer (, from gl_util.c:


typedef void (*(*get_gl_proc_fptr_t)(const GLubyte *))();

void init_opengl_extensions()
get_gl_proc_fptr_t get_gl_proc;
#ifdef WIN32
get_gl_proc = (get_gl_proc_fptr_t) wglGetProcAddress;
get_gl_proc = (get_gl_proc_fptr_t) glXGetProcAddressARB;

if ( glutExtensionSupported( "GL_EXT_compiled_vertex_array" ) ) {
    print_debug( DEBUG_GL_EXT, "GL_EXT_compiled_vertex_array extension "
                 "supported" );
        get_gl_proc( (GLubyte*) "glLockArraysEXT" );
        get_gl_proc( (GLubyte*) "glUnlockArraysEXT" );
} else {
    print_debug( DEBUG_GL_EXT, "GL_EXT_compiled_vertex_array extension "
                 "NOT supported" );
    glLockArraysEXT_p = NULL;
    glUnlockArraysEXT_p = NULL;

if ( glutExtensionSupported( "GL_ARB_texture_cube_map" ) ) {
    print_debug( DEBUG_GL_EXT, "GL_ARB_texture_cube_map extension "
                 "supported" );
} else {
    print_debug( DEBUG_GL_EXT, "GL_ARB_texture_cube_map extension "
                 "NOT supported" );


Hope that helps.

(The preceeding code is Copyright © 1999-2000 Jasmin F. Patry and is under the GPL)

Nice one!