# Allegro Graphics Driver

These functions are used to implement Allegro function over an OpenGL screen. More...

## Defines

- #define SET_TEX_COORDS(x, y)
- #define BITMAP_BLIT_CLIP(source, dest, source_x, source_y, dest_x, dest_y, width, height)

## Functions

- int __allegro_gl_make_power_of_2 (int x)
- void allegro_gl_drawing_mode (void)
- void split_color (int color, GLubyte *r, GLubyte *g, GLubyte *b, GLubyte *a, int color_depth)
- void allegro_gl_created_sub_bitmap (BITMAP *bmp, BITMAP *parent)
- static void allegro_gl_screen_acquire (struct BITMAP *bmp)
    acquire_bitmap(screen) overload.
- static void allegro_gl_screen_release (struct BITMAP *bmp)
    release_bitmap(screen) overload.
- static int allegro_gl_screen_getpixel (struct BITMAP *bmp, int x, int y)
- static void allegro_gl_screen_putpixel (struct BITMAP *bmp, int x, int y, int color)
- static void allegro_gl_screen_vline (struct BITMAP *bmp, int x, int y1, int y2, int color)
- static void allegro_gl_screen_hline (struct BITMAP *bmp, int x1, int y, int x2, int color)
- static void allegro_gl_screen_line (struct BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
- void allegro_gl_screen_rectfill (struct BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
- static void allegro_gl_screen_triangle (struct BITMAP *bmp, int x1, int y1, int x2, int y2, int x3, int y3, int color)
- static void allegro_gl_screen_blit_from_memory (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)
- static void allegro_gl_screen_blit_to_memory (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)
- void allegro_gl_screen_blit_to_self (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)
- void allegro_gl_upload_and_display_texture (struct BITMAP *source, int source_x, int source_y, int dest_x, int dest_y, int width, int height, int flip_dir, GLint format, GLint type)
- static void do_screen_masked_blit_standard (GLint format, GLint type, struct BITMAP *temp, int source_x, int source_y, int dest_x, int dest_y, int width, int height, int flip_dir, int blit_type)
- static void screen_masked_blit_standard (struct BITMAP *source, int source_x, int source_y, int dest_x, int dest_y, int width, int height, int flip_dir, int blit_type)
- static void __allegro_gl_init_nv_register_combiners (BITMAP *bmp)
- static void screen_masked_blit_nv_register (struct BITMAP *source, int source_x, int source_y, int dest_x, int dest_y, int width, int height, int flip_dir, int blit_type)
- static void __allegro_gl_init_combine_textures (BITMAP *bmp)
- static void screen_masked_blit_combine_tex (struct BITMAP *source, int source_x, int source_y, int dest_x, int dest_y, int width, int height, int flip_dir, int blit_type)
- void do_masked_blit_screen (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height, int flip_dir, int blit_type)
- static BITMAP * __allegro_gl_convert_rle_sprite (AL_CONST struct RLE_SPRITE *sprite, int trans)
- void allegro_gl_screen_draw_rle_sprite (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y)
- static void allegro_gl_screen_draw_trans_rgba_rle_sprite (struct BITMAP *bmp, AL_CONST struct RLE_SPRITE *sprite, int x, int y)
- static void allegro_gl_screen_masked_blit (struct BITMAP *source, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)
- static void allegro_gl_screen_draw_sprite (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y)
- static void allegro_gl_screen_draw_sprite_v_flip (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y)
- static void allegro_gl_screen_draw_sprite_h_flip (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y)
- static void allegro_gl_screen_draw_sprite_vh_flip (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y)
- static void allegro_gl_screen_pivot_scaled_sprite_flip (struct BITMAP *bmp, struct BITMAP *sprite, fixed x, fixed y, fixed cx, fixed cy, fixed angle, fixed scale, int v_flip)
- static void allegro_gl_screen_draw_trans_rgba_sprite (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y)
- static void allegro_gl_screen_draw_sprite_ex (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int mode, int flip)
- void allegro_gl_screen_draw_glyph_ex (struct BITMAP *bmp, AL_CONST struct FONT_GLYPH *glyph, int x, int y, int color, int bg, int flip)
- static void allegro_gl_screen_draw_glyph (struct BITMAP *bmp, AL_CONST struct FONT_GLYPH *glyph, int x, int y, int color, int bg)
- void allegro_gl_screen_draw_color_glyph_ex (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color, int bg, int flip)
- static void allegro_gl_screen_draw_color_glyph (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color, int bg)
- static void allegro_gl_screen_draw_character (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y, int color, int bg)
- static void allegro_gl_screen_draw_256_sprite (struct BITMAP *bmp, struct BITMAP *sprite, int x, int y)
- void allegro_gl_screen_clear_to_color (struct BITMAP *bmp, int color)
- static void allegro_gl_screen_polygon (struct BITMAP *bmp, int vertices, AL_CONST int *points, int color)
- static void allegro_gl_screen_rect (struct BITMAP *bmp, int x1, int y1, int x2, int y2, int color)
- void allegro_gl_screen_polygon3d_f (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D_f *vtx[])
- static void allegro_gl_screen_polygon3d (struct BITMAP *bmp, int type, struct BITMAP *texture, int vc, V3D *vtx[])
- static void allegro_gl_screen_quad3d_f (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3, V3D_f *v4)
- static void allegro_gl_screen_quad3d (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3, V3D *v4)
- static void allegro_gl_screen_triangle3d (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D *v1, V3D *v2, V3D *v3)
- static void allegro_gl_screen_triangle3d_f (struct BITMAP *bmp, int type, struct BITMAP *texture, V3D_f *v1, V3D_f *v2, V3D_f *v3)
- void __allegro_gl__glvtable_update_vtable (GFX_VTABLE **vtable)
- void allegro_gl_memory_blit_between_formats (struct BITMAP *src, struct BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height)
- static void dummy_unwrite_bank (void)
- static void allegro_gl_video_acquire (struct BITMAP *bmp)
    acquire_bitmap(bmp) overload.
- static void allegro_gl_video_release (struct BITMAP *bmp)
    release_bitmap(bmp) overload.

## Variables

- static double allegro_gl_projection_matrix [16]
- static double allegro_gl_modelview_matrix [16]
- static GFX_VTABLE allegro_gl_screen_vtable

## Detailed Description

These functions are used to implement Allegro function over an OpenGL screen.

Keep in mind that some restictions mentioned in Allegro docs about video bitmaps and the screen do not apply when using AllegroGL GFX driver. Namely:

- Reading from video bitmaps is just as fast as reading from memory bitmaps.
- Doing translucent/transparent drawing on the screen can be very fast if the source is a video bitmap.
- Drawing from video bitmap to a video bitmap will be pretty fast on modern GFX cards with appropiate drivers installed.
- There are dozen of places in the Allegro docs where it says that a memory bitmap must be used (drawing_mode(), polygon3d(), stretch_sprite() etc.). This doesn't apply when AllegroGL is used. You can also use video bitmaps and it will be quite fast.

## Define Documentation

#define SET_TEX_COORDS | ( | x,
|  | y |  | ) |

Value:

    do {                      \
            if (__agl_drawing_pattern_tex) {  \
                glTexCoord2f (                \
                    (x - _drawing_x_anchor) / (float)__agl_drawing_pattern_bmp->w,\
                    (y - _drawing_y_anchor) / (float)__agl_drawing_pattern_bmp->h \
                );                                                                \
            }                                                                     \
        } while(0)

Definition at line 348 of file glvtable.c.

## Function Documentation

static void allegro_gl_screen_acquire | ( | struct BITMAP * | bmp | ) | `[static]`

acquire_bitmap(screen) overload.

This doesn't do anything, since OpenGL rendering context doesn't need locking. You don't need to call this function in your program.

Definition at line 160 of file glvtable.c.

static void allegro_gl_screen_release | ( | struct BITMAP * | bmp | ) | `[static]`

release_bitmap(screen) overload.

This doesn't do anything, since OpenGL rendering context doesn't need locking. You don't need to call this function in your program.

Definition at line 170 of file glvtable.c.

static void allegro_gl_video_acquire | ( | struct BITMAP * | bmp | ) | `[static]`

acquire_bitmap(bmp) overload.

This doesn't do anything, since OpenGL textures doesn't need locking. You don't need to call this function in your program.

Definition at line 437 of file videovtb.c.

static void allegro_gl_video_release | ( | struct BITMAP * | bmp | ) | `[static]`

release_bitmap(bmp) overload.

This doesn't do anything, since OpenGL textures doesn't need locking. You don't need to call this function in your program.

Definition at line 448 of file videovtb.c.