AllegroGL: Core routines

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

# Core routines

Basic AllegroGL functions. More...

## 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.

## Functions

- 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 ()
    Returns the OpenGL version number of the client (the computer the program is running on).

## Detailed Description

Basic AllegroGL functions.

These functions allow you to initialize AllegroGL, set up a rendering context via set_gfx_mode(), and allow access to regular OpenGL functions.

## Define Documentation

#define allegro_gl_begin | ( |  | ) | ;

Backward compatibility #define for programs written prior to AGL 0.0.22.

It isn't defined as anything meaningful, so you don't need to put them in your program.

See also:
  allegro_gl_end()

Definition at line 166 of file alleggl.h.

#define allegro_gl_end | ( |  | ) | ;

Backward compatibility #define for programs written prior to AGL 0.0.22.

It isn't defined as anything meaningful, so you don't need to put them in your program.

See also:
  allegro_gl_begin()

Definition at line 176 of file alleggl.h.

## Function Documentation

int install_allegro_gl | ( | void |  | ) |

Installs the AllegroGL addon to Allegro.

Allegro should already be initialized with allegro_init() or install_allegro().

Returns:
  0 on success; -1 on failure.

See also:
  remove_allegro_gl()

Definition at line 836 of file alleggl.c.

References __blit_between_formats15, __blit_between_formats16, __blit_between_formats24, __blit_between_formats32, __blit_between_formats8, allegro_gl_clear_settings(), allegro_gl_error, allegro_gl_memory_blit_between_formats(), list_saved_gfx_drivers(), our_gfx_drivers(), remove_allegro_gl(), and saved_gfx_drivers.

void remove_allegro_gl | ( | void |  | ) |

Removes the AllegroGL addon.

You should not call any more OpenGL or AllegroGL functions after calling this function. Note that it will be called automatically at program exit, so you don't need to explicitly do it.

See also:
  install_allegro_gl()

Definition at line 894 of file alleggl.c.

References __blit_between_formats15, __blit_between_formats16, __blit_between_formats24, __blit_between_formats32, __blit_between_formats8, list_saved_gfx_drivers(), and saved_gfx_drivers.

Referenced by install_allegro_gl().

void allegro_gl_flip | ( | void |  | ) |

Flips the front and back framebuffers.

If you chose, or were given, a double buffered OpenGL mode, you have access to a front buffer, which is visible on the screen, and also a back buffer, which is not visible. This routine flips the buffers, so that the contents of the back buffer is now the contents of the (visible) front buffer. The contents of the backbuffer is undefined after the operation.

Normally in these modes you would do all your drawing to the back buffer, without the user seeing the image while it's partially drawn, and then call this function to flip the buffers, allowing the user to see what you've drawn, now that it's finished, while you proceed to draw the next frame.

When drawing to the screen bitmap, you may not be drawing to what user currently sees on his monitor. It is recommended that you rebuild the screen every frame, then flip, then draw again.

See also:
  allegro_gl_set(), AGL_DOUBLEBUFFER

Definition at line 951 of file alleggl.c.

References __allegro_gl_driver, and allegro_gl_driver::flip.

Referenced by algl_popup_dialog(), and d_algl_viewport_proc().

float allegro_gl_opengl_version | ( | void |  | ) |

Returns the OpenGL version number of the client (the computer the program is running on).

"1.0" is returned as 1.0, "1.2.1" is returned as 1.21, and "1.2.2" as 1.22, etc.

A valid OpenGL context must exist for this function to work, which means you may not call it before set_gfx_mode(GFX_OPENGL)

Returns:
  The OpenGL ICD/MCD version number.

Definition at line 971 of file alleggl.c.

References __allegro_gl_valid_context.

Referenced by allegro_gl_set_blender_mode().