# OpenGL Extensions

Management of the OpenGL extensions mechanism. More...

## Functions

- int allegro_gl_is_extension_supported (AL_CONST char *extension)
    This function is an helper to determine whether an OpenGL extension is available or not.
- void * allegro_gl_get_proc_address (AL_CONST char *name)
    Helper to get the address of an OpenGL symbol.

## Variables

- struct AGL_EXTENSION_LIST_GL allegro_gl_extensions_GL
    List of OpenGL extensions supported by AllegroGL.
- AGL_EXT * agl_extension_table = NULL
    List of GLX extensions supported by AllegroGL.

## OpenGL Extensions Management Functions

- #define AGL_DEFINE_PROC_TYPE
    OpenGL extensions handlers helper.

## Detailed Description

Management of the OpenGL extensions mechanism.

AllegroGL provides two ways to access OpenGL extensions: It's native extension library and some versatile portable routines.

If you want to get more control on extensions or if you want to use an extension that is not supported by AllegroGL then you can use the routines : allegro_gl_is_extension_supported() and allegro_gl_get_proc_address(). They provide a way to determine if an extension is available and to get its address. These routines are available on every platforms that AllegroGL supports

## Define Documentation

#define AGL_DEFINE_PROC_TYPE

OpenGL extensions handlers helper.

Defines a function pointer type. This macro is almost equivalent to a typedef. It is intended to hide some platform-specific machinery in order to keep code portable.

See also:
  allegro_gl_get_proc_address()

Definition at line 751 of file alleggl.h.

## Function Documentation

int allegro_gl_is_extension_supported | ( | AL_CONST char * | extension | ) |

This function is an helper to determine whether an OpenGL extension is available or not.

Example:

           int packedpixels =
                      allegro_gl_is_extension_supported("GL_EXT_packed_pixels");

If `packedpixels` is TRUE then you can safely use the constants related to the packed pixels extension.

Parameters:

  | extension | The name of the extension that is needed

Returns:
  TRUE if the extension is available FALSE otherwise.

Definition at line 306 of file glext.c.

void* allegro_gl_get_proc_address | ( | AL_CONST char * | name | ) |

Helper to get the address of an OpenGL symbol.

Example: How to get the function `glMultiTexCoord3fARB` that comes with ARB's Multitexture extension :

      // define the type of the function
    	AGL_DEFINE_PROC_TYPE(void, MULTI_TEX_FUNC,
    	                                      (GLenum, GLfloat, GLfloat, GLfloat));
      // declare the function pointer
    	MULTI_TEX_FUNC glMultiTexCoord3fARB;
      // get the address of the function
     	glMultiTexCoord3fARB = (MULTI_TEX_FUNC) allegro_gl_get_proc_address(
     	                                                   "glMultiTexCoord3fARB");

If `glMultiTexCoord3fARB` is not `NULL` then it can be used as if it has been defined in the OpenGL core library. Note that the use of the AGL_DEFINE_PROC_TYPE macro is mandatory if you want your program to be portable.

Parameters:

  | name | The name of the symbol you want to link to.

Returns:
  A pointer to the symbol if available or NULL otherwise.

Definition at line 372 of file glext.c.

## Variable Documentation

struct AGL_EXTENSION_LIST_GL allegro_gl_extensions_GL

List of OpenGL extensions supported by AllegroGL.

Each entry of this structure is an int which is either set to 1, if the corresponding extension is available on the host system, or 0 otherwise.

Extension names use only the base name. For example, GL_ARB_multitexture should be refered to by:

       allegro_gl_extensions_GL.ARB_multitexture

See also:
  allegro_gl_extensions_GLX allegro_gl_extensions_WGL

Definition at line 55 of file glext.c.

Referenced by allegro_gl_make_texture_ex().

AGL_EXT* agl_extension_table = NULL

List of GLX extensions supported by AllegroGL.

See also:
  allegro_gl_extensions_GL allegro_gl_extensions_WGL List of WGL OpenGL Extensions supported by AllegroGL.

  allegro_gl_extensions_GL allegro_gl_extensions_GLX

Definition at line 82 of file glext.c.