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 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.
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.
extension | The name of the extension that is needed |
Definition at line 306 of file glext.c.
Referenced by allegro_gl_set_blender_mode().
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.
name | The name of the symbol you want to link to. |
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
Definition at line 55 of file glext.c.
Referenced by __allegro_gl_munge_bitmap(), allegro_gl_make_texture_ex(), allegro_gl_make_video_bitmap_helper0(), allegro_gl_make_video_bitmap_helper1(), allegro_gl_screen_blit_from_memory(), allegro_gl_screen_blit_to_memory(), allegro_gl_set_mouse_sprite(), do_masked_blit_screen(), do_texture_upload(), and update_texture_memory().
AGL_EXT* agl_extension_table = NULL |
List of WGL extensions supported by AllegroGL.