# alleggl.h File Reference

Main header file for AllegroGL. More...

`#include <allegro.h>`
`#include <GL/gl.h>`
`#include "allegrogl/gl_ext.h"`

Go to the source code of this file.

## Defines

- #define _AGL_DLL
- #define AGL_VAR(type, name) extern _AGL_DLL type name
- #define AGL_FUNC(type, name, args) extern type name args
- #define __glext_h_
- #define __glxext_h_
- #define AGL_ERROR_SIZE 256
- #define AGL_FLOAT_COLOR 0x00800000
    Floating-point Color buffer.
- #define AGL_FLOAT_Z 0x01000000
    Floating-point Depth buffer.
- #define AGL_CONFIG_RESRVED 0xA000000

Version Information

- #define AGL_VERSION 0
    Major version number.
- #define AGL_SUB_VERSION 4
    Minor version number.
- #define AGL_WIP_VERSION 4
    Work-In-Progress version number.
- #define AGL_VERSION_STR "0.4.4"
    Version description string.

Frame Buffer Settings

- #define AGL_ALLEGRO_FORMAT 0x00000001
    Use Allegro-compatible framebuffer.
- #define AGL_RED_DEPTH 0x00000002
    Select the red depth of the frame buffer.
- #define AGL_GREEN_DEPTH 0x00000004
    Select the green depth of the frame buffer.
- #define AGL_BLUE_DEPTH 0x00000008
    Select the blue depth of the frame buffer.
- #define AGL_ALPHA_DEPTH 0x00000010
    Select the alpha depth of the frame buffer.
- #define AGL_COLOR_DEPTH 0x00000020
    Specify the total color depth of the frame buffer.
- #define AGL_ACC_RED_DEPTH 0x00000040
    Select the red depth of the accumulator buffer.
- #define AGL_ACC_GREEN_DEPTH 0x00000080
    Select the green depth of the accumulator buffer.
- #define AGL_ACC_BLUE_DEPTH 0x00000100
    Select the blue depth of the accumulator buffer.
- #define AGL_ACC_ALPHA_DEPTH 0x00000200
    Select the alpha depth of the accumulator buffer.
- #define AGL_DOUBLEBUFFER 0x00000400
    Creates a backbuffer if set.
- #define AGL_STEREO 0x00000800
    Creates seperate left/right buffers for stereo display.
- #define AGL_AUX_BUFFERS 0x00001000
    Creates additional auxiliary buffers.
- #define AGL_Z_DEPTH 0x00002000
    Select the depth of the z-buffer.
- #define AGL_STENCIL_DEPTH 0x00004000
    Select the depth of the stencil buffer.
- #define AGL_WINDOW_X 0x00008000
    Requests a placement of the window to a specified pixel location.
- #define AGL_WINDOW_Y 0x00010000
    Same as AGL_WINDOW_X, but for the y-axis.
- #define AGL_RENDERMETHOD 0x00020000
    Set it if you'd like AllegroGL to pay special attention on whether hardware acceleration is present or not.
- #define AGL_FULLSCREEN 0x00040000
    Set if you'd like a full screen mode.
- #define AGL_WINDOWED 0x00080000
    Set if you'd like a windowed mode.
- #define AGL_VIDEO_MEMORY_POLICY 0x00100000
    Define AllegroGL's policy relative to video memory usage.
- #define AGL_SAMPLE_BUFFERS 0x00200000
    Define multisample parameters Some OpenGL ICDs expose an extension called GL_ARB_multisample which provides a mechanism to anti-alias all GL primitives: points, lines, polygons, bitmaps and pixel rectangles.
- #define AGL_SAMPLES 0x00400000
    Define multisample samples Set this value to the number of samples that can be accepted in the multisample buffers.

Mode selection priority options

- #define AGL_DONTCARE 0
    Ignore these settings.
- #define AGL_SUGGEST -1
    Prefer the assigned values for these settings.
- #define AGL_REQUIRE -2
    Reject other values for these settings.

Video memory policy options

- #define AGL_KEEP 1
    Keep internal texture in video memory.
- #define AGL_RELEASE 2
    Release video memory occupied by internal texture.

Graphics drivers

- #define GFX_OPENGL_WINDOWED
    Windowed OpenGL graphics driver for Allegro.
- #define GFX_OPENGL_FULLSCREEN
    Fullscreen OpenGL graphics driver for Allegro.
- #define GFX_OPENGL
    Non-specific OpenGL graphics driver for Allegro.

OpenGL Extensions Management Functions

- #define AGL_DEFINE_PROC_TYPE
    OpenGL extensions handlers helper.

## Functions

- int algl_do_dialog (DIALOG *dialog, int focus_obj)
    AllegroGL-friendly version of do_dialog.
- int algl_popup_dialog (DIALOG *dialog, int focus_obj)
    AllegroGL-friendly version of popup_dialog.
- void algl_draw_mouse (void)
    Draws a mouse pointer on the screen.
- void algl_set_mouse_drawer (void(*user_draw_mouse)(void))
    Sets (or clears) a user mouse drawing callback.
- int algl_alert (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3, AL_CONST char *b1, AL_CONST char *b2, int c1, int c2)
    AllegroGL-friendly version of Allegro's alert.
- int algl_alert3 (AL_CONST char *s1, AL_CONST char *s2, AL_CONST char *s3, AL_CONST char *b1, AL_CONST char *b2, AL_CONST char *b3, int c1, int c2, int c3)
    AllegroGL-friendly version of Allegro's alert3.
- int d_algl_viewport_proc (int msg, DIALOG *d, int c)
    Creates a viewport object where OpenGL commands can be performed.

Mode selection functions

- void allegro_gl_clear_settings (void)
    Clear the option settings All settings are set to their default values, and marked as neither suggested not required.
- void allegro_gl_set (int option, int value)
    Sets a configuration option.
- int allegro_gl_get (int option)
    Reads the setting of a configuration option.
- void allegro_gl_save_settings ()
    Saves the current settings (as specified by allegro_gl_set()) to the current config file, in the section [OpenGL].
- void allegro_gl_load_settings ()
    Loads the settings from the current config file, in the section [OpenGL].

Video Bitmap Rountines

- GLint allegro_gl_set_video_bitmap_color_depth (int bpp)
    Sets the color depth you'd like AllegroGL to use for video bitmaps.

Allegro Interfacing routines

- void allegro_gl_set_allegro_mode (void)
    Prepares for Allegro drawing to the screen.
- void allegro_gl_unset_allegro_mode (void)
    Restores previous OpenGL settings.
- void allegro_gl_set_projection (void)
    Prepares for Allegro drawing to the screen.
- void allegro_gl_unset_projection (void)
    Restores previously saved projection.

Matrix conversion routines

- void allegro_gl_MATRIX_to_GLfloat (MATRIX *m, GLfloat gl[16])
    Converts an Allegro fixed-point matrix to an array of floats suitable for OpenGL's matrix operations.
- void allegro_gl_MATRIX_to_GLdouble (MATRIX *m, GLdouble gl[16])
    Converts an Allegro fixed-point matrix to an array of doubles suitable for OpenGL's matrix operations.
- void allegro_gl_MATRIX_f_to_GLfloat (MATRIX_f *m, GLfloat gl[16])
    Converts an Allegro floating-point matrix to an array of floats suitable for OpenGL's matrix operations.
- void allegro_gl_MATRIX_f_to_GLdouble (MATRIX_f *m, GLdouble gl[16])
    Converts an Allegro floating-point matrix to an array of doubles suitable for OpenGL's matrix operations.
- void allegro_gl_GLfloat_to_MATRIX (GLfloat gl[16], MATRIX *m)
    Converts an OpenGL floating-point matrix issued from the matrix stack to an Allegro fixed-point matrix.
- void allegro_gl_GLdouble_to_MATRIX (GLdouble gl[16], MATRIX *m)
    Converts an OpenGL double precision floating-point matrix issued from the matrix stack to an Allegro fixed-point matrix.
- void allegro_gl_GLfloat_to_MATRIX_f (GLfloat gl[16], MATRIX_f *m)
    Converts an OpenGL floating-point matrix issued from the matrix stack to an Allegro floating-point matrix.
- void allegro_gl_GLdouble_to_MATRIX_f (GLdouble gl[16], MATRIX_f *m)
    Converts an OpenGL double precision floating-point matrix issued from the matrix stack to an Allegro single-precision floating-point matrix.

Quaternion conversion routines

- void allegro_gl_apply_quat (QUAT *q)
    Multiplies the Quaternion to the current transformation matrix, by converting it to a call to glRotatef().
- void allegro_gl_quat_to_glrotatef (QUAT *q, float *angle, float *x, float *y, float *z)
    Converts a quaternion to a vector/angle, which can be used with glRotate*().
- void allegro_gl_quat_to_glrotated (QUAT *q, double *angle, double *x, double *y, double *z)
    Converts a quaternion to a vector/angle, which can be used with glRotate*().

## Variables

- char allegro_gl_error [256]
- GFX_DRIVER gfx_allegro_gl_default
- GFX_DRIVER gfx_allegro_gl_windowed
- GFX_DRIVER gfx_allegro_gl_fullscreen

## Core Functions

- #define allegro_gl_begin() ;
    Backward compatibility #define for programs written prior to AGL 0.0.22.
- #define allegro_gl_end() ;
    Backward compatibility #define for programs written prior to AGL 0.0.22.
- int install_allegro_gl (void)
    Installs the AllegroGL addon to Allegro.
- void remove_allegro_gl (void)
    Removes the AllegroGL addon.
- void allegro_gl_flip (void)
    Flips the front and back framebuffers.
- float allegro_gl_opengl_version (void)
    Returns the OpenGL version number of the client (the computer the program is running on).

## Texture routines

- #define AGL_TEXTURE_MIPMAP 0x01
    AllegroGL will generate mipmaps for this texture.
- #define AGL_TEXTURE_HAS_ALPHA 0x02
    Tell AllegroGL that the bitmap had an alpha channel, so it should be preserved when generating the texture.
- #define AGL_TEXTURE_FLIP 0x04
    Flip the texture on the x-axis.
- #define AGL_TEXTURE_MASKED 0x08
    Generate an alpha channel for this texture, based on the Allegro mask color.
- #define AGL_TEXTURE_RESCALE 0x10
    Tell AllegroGL to allow rescaling of the bitmap.
- #define AGL_TEXTURE_ALPHA_ONLY 0x20
    Tell AllegroGL that the specified BITMAP is an 8-bpp alpha-only BITMAP.
- int allegro_gl_use_mipmapping (int enable)
    Tell AllegroGL to use Mipmapping or not when generating textures via its functions.
- int allegro_gl_use_alpha_channel (int enable)
    Tell AllegroGL to use Alpha channel or not when generating textures via its functions.
- int allegro_gl_flip_texture (int enable)
    Tell AllegroGL to flip the texture vertically or not when generating textures via its functions, to conform to the usual OpenGL texture coordinate system (increasing upwards).
- int allegro_gl_check_texture (BITMAP *bmp)
    Checks whether the specified bitmap is of the proper size for texturing.
- int allegro_gl_check_texture_ex (int flags, BITMAP *bmp, GLint internal_format)
    Checks whether the specified bitmap is of the proper size for texturing.
- GLint allegro_gl_get_texture_format (BITMAP *bmp)
    Returns the OpenGL internal texture format for this bitmap.
- GLint allegro_gl_set_texture_format (GLint format)
    Sets the color format you'd like OpenGL to use for its textures.
- GLenum allegro_gl_get_bitmap_type (BITMAP *bmp)
    AllegroGL will generate mipmaps for this texture.
- GLenum allegro_gl_get_bitmap_color_format (BITMAP *bmp)
    AllegroGL will generate mipmaps for this texture.
- GLuint allegro_gl_make_texture (BITMAP *bmp)
    Uploads an Allegro BITMAP to the GL driver as a texture.
- GLuint allegro_gl_make_masked_texture (BITMAP *bmp)
    Uploads an Allegro BITMAP to the GL driver as a texture.
- GLuint allegro_gl_make_texture_ex (int flags, BITMAP *bmp, GLint internal_format)
    Uploads an Allegro BITMAP to the GL driver as a texture.

## Text Drawing and Font conversion

- #define AGL_FONT_TYPE_DONT_CARE -1
    Indicates that you don't really care how a font will be converted.
- #define AGL_FONT_TYPE_BITMAP 0
    Indicates that you want fonts to be converted to a bitmap format.
- #define AGL_FONT_TYPE_OUTLINE 1
    Indicates that you want fonts to be converted to an outline format.
- #define AGL_FONT_TYPE_TEXTURED 2
    Indicates that you want fonts to be converted to a texture format.
- #define AGL_FONT_STYLE_BOLD 1
    Creates a font with bold characters.
- #define AGL_FONT_STYLE_BLACK 2
    Creates a font with black (strong bold) characters.
- #define AGL_FONT_STYLE_ITALIC 4
    Creates a font with italicized characters.
- #define AGL_FONT_STYLE_UNDERLINE 8
    Creates a font with underlined characters.
- #define AGL_FONT_STYLE_STRIKEOUT 16
    Creates a font with striked out characters.
- #define AGL_FONT_STYLE_ANTI_ALIASED 32
    Creates a font with anti-aliased characters.
- #define AGL_FONT_POLYGONS 1
    Font generation mode.
- #define AGL_FONT_LINES 2
    Font generation mode.
- int allegro_gl_printf (AL_CONST FONT *f, float x, float y, float z, int color, AL_CONST char *format,...)
    Equivalent to:.
- int allegro_gl_printf_ex (AL_CONST FONT *f, float x, float y, float z, AL_CONST char *format,...)
    Prints a formatted string (printf style) on the screen.
- FONT * allegro_gl_convert_allegro_font (FONT *f, int type, float scale)
    Equivalent to:.
- FONT * allegro_gl_convert_allegro_font_ex (FONT *f, int type, float scale, GLint format)
    Converts a regular Allegro FONT to the AGL format for 3D display.
- void allegro_gl_set_font_generation_mode (int mode)
    Set the font generation mode for system fonts.
- FONT * allegro_gl_load_system_font (char *name, int style, int w, int h)
    Short hand for aglf_load_system_font_ex(name, AGL_FONT_TYPE_OUTLINE, style, w, h, 0.0f, 32, 256).
- FONT * allegro_gl_load_system_font_ex (char *name, int type, int style, int w, int h, float depth, int start, int end)
    Loads a system font.
- void allegro_gl_destroy_font (FONT *f)
    void allegro_gl_destroy_font(FONT *usefont)
- size_t allegro_gl_list_font_textures (FONT *f, GLuint *ids, size_t max_num_id)
    List the texture ID of all textures forming the specified font.

## Detailed Description

Main header file for AllegroGL.

Definition in file alleggl.h.