Unit al5opengl

Uses
Classes, Interfaces, Objects and Records
Constants
Variables

Description

OpenGL integration.

You can disable the detection of any OpenGL extension by Allegro with a section like this in allegro5.cfg:

[opengl_disabled_extensions]
GL_ARB_texture_non_power_of_two=0
GL_EXT_framebuffer_object=0

Any extension which appears in the section is treated as not available (it does not matter if you set it to 0 or any other value).

Overview

Functions and Procedures

FUNCTION al_get_opengl_version: AL_UINT32; CDECL; EXTERNAL ALLEGRO_LIB_NAME;
FUNCTION al_have_opengl_extension (CONST extension: AL_STR): AL_BOOL; CDECL; EXTERNAL ALLEGRO_LIB_NAME;
FUNCTION al_get_opengl_proc_address (CONST name: AL_STR): AL_VOIDptr; CDECL; EXTERNAL ALLEGRO_LIB_NAME;
FUNCTION al_get_opengl_texture (bitmap: ALLEGRO_BITMAPptr): GLuint; CDECL; EXTERNAL ALLEGRO_LIB_NAME;
PROCEDURE al_remove_opengl_fbo (bitmap: ALLEGRO_BITMAPptr); CDECL; EXTERNAL ALLEGRO_LIB_NAME;
FUNCTION al_get_opengl_fbo (bitmap: ALLEGRO_BITMAPptr): GLuint; CDECL; EXTERNAL ALLEGRO_LIB_NAME;
PROCEDURE al_get_opengl_texture_size (bitmap: ALLEGRO_BITMAPptr; OUT w, h: AL_INT); CDECL; EXTERNAL ALLEGRO_LIB_NAME;
PROCEDURE al_get_opengl_texture_position (bitmap: ALLEGRO_BITMAPptr; OUT u, v: AL_INT); CDECL; EXTERNAL ALLEGRO_LIB_NAME;
PROCEDURE al_set_current_opengl_context (display: ALLEGRO_DISPLAYptr); CDECL; EXTERNAL ALLEGRO_LIB_NAME;
FUNCTION al_get_opengl_variant: AL_INT; CDECL; EXTERNAL ALLEGRO_LIB_NAME;

Types

ALLEGRO_OPENGL_VARIANT = (...);

Description

Functions and Procedures

FUNCTION al_get_opengl_version: AL_UINT32; CDECL; EXTERNAL ALLEGRO_LIB_NAME;

Returns the OpenGL or OpenGL ES version number of the client (the computer the program is running on), for the current display. "1.0" is returned as $01000000, "1.2.1" is returned as $01020100, and "1.2.2" as $01020200 ,etc.

A valid OpenGL context must exist for this function to work, which means you may not call it before al_create_display.

See also
al_get_opengl_variant
FUNCTION al_have_opengl_extension (CONST extension: AL_STR): AL_BOOL; CDECL; EXTERNAL ALLEGRO_LIB_NAME;

This function is a helper to determine whether an OpenGL extension is available on the given display or not.

Example

packedpixels := al_have_opengl_extension ('GL_EXT_packed_pixels');

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

Returns

True if the extension is available; False otherwise.

See also
al_get_opengl_proc_address
Helper to get the address of an OpenGL symbol.
FUNCTION al_get_opengl_proc_address (CONST name: AL_STR): AL_VOIDptr; CDECL; EXTERNAL ALLEGRO_LIB_NAME;

Helper to get the address of an OpenGL symbol.

Example

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

  TYPE
  // define the type of the function.
    MULTI_TEX_FUNC: PROCEDURE (a: GLenum; b, c, d: GLfloat); CDECL;
  VAR
  // declare the function pointer.
    glMultiTexCoord3fARB: MULTI_TEX_FUNC;
  BEGIN
  // get the address of the function.
    glMultiTexCoord3fARB := MULTI_TEX_FUNC (al_get_opengl_proc_address ('glMultiTexCoord3fARB'));
  END;

If glMultiTexCoord3fARB is not Nil then it can be used as if it has been defined in the OpenGL core library.

Parameters
name
The name of the symbol you want to link to.
Returns

A pointer to the symbol if available or Nil otherwise.

See also
al_have_opengl_extension
This function is a helper to determine whether an OpenGL extension is available on the given display or not.
FUNCTION al_get_opengl_texture (bitmap: ALLEGRO_BITMAPptr): GLuint; CDECL; EXTERNAL ALLEGRO_LIB_NAME;

Returns the OpenGL texture id internally used by the given bitmap if it uses one, else 0.

Example

  Bitmap := al_load_bitmap ('my_texture.png');
  Texture := al_get_opengl_texture (Bitmap);
  IF texture <> NIL THEN glBindTexture (GL_TEXTURE_2D, Texture);

PROCEDURE al_remove_opengl_fbo (bitmap: ALLEGRO_BITMAPptr); CDECL; EXTERNAL ALLEGRO_LIB_NAME;
 
FUNCTION al_get_opengl_fbo (bitmap: ALLEGRO_BITMAPptr): GLuint; CDECL; EXTERNAL ALLEGRO_LIB_NAME;
 
PROCEDURE al_get_opengl_texture_size (bitmap: ALLEGRO_BITMAPptr; OUT w, h: AL_INT); CDECL; EXTERNAL ALLEGRO_LIB_NAME;
 
PROCEDURE al_get_opengl_texture_position (bitmap: ALLEGRO_BITMAPptr; OUT u, v: AL_INT); CDECL; EXTERNAL ALLEGRO_LIB_NAME;
 
PROCEDURE al_set_current_opengl_context (display: ALLEGRO_DISPLAYptr); CDECL; EXTERNAL ALLEGRO_LIB_NAME;

TODO: al_get_opengl_program_object, when shaders are implemented.

FUNCTION al_get_opengl_variant: AL_INT; CDECL; EXTERNAL ALLEGRO_LIB_NAME;
 

Types

ALLEGRO_OPENGL_VARIANT = (...);

***************************************************************************** * allegro_opengl.h * Main header file for all OpenGL drivers. * * By Milan Mimica.

Values
  • ALLEGRO_DESKTOP_OPENGL = 0
  • ALLEGRO_OPENGL_ES

Generated by PasDoc 0.14.0. Generated on 2017-01-03 13:25:50.