# glvtable.c File Reference

Allegro->OpenGL conversion vtable. More...

`#include <string.h>`
`#include <allegro.h>`
`#include "alleggl.h"`
`#include "allglint.h"`
`#include "glvtable.h"`
`#include <allegro/internal/aintern.h>`
`#include <GL/glu.h>`

Go to the source code of this file.

## Defines

- #define SET_TEX_COORDS(x, y)
- #define BITMAP_BLIT_CLIP(source, dest, source_x, source_y, dest_x, dest_y, width, height)
- #define DRAW_RLE_8888(bits)
- #define BIN_2_DEG(x) (-(x) * 180.0 / 128)

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

## Variables

- static GFX_VTABLE allegro_gl_screen_vtable
- static GLuint __allegro_gl_pool_texture = 0
- static GLuint __allegro_gl_dummy_texture = 0
- static int __agl_owning_drawing_pattern_tex = FALSE
- GLuint __agl_drawing_pattern_tex = 0
- BITMAP * __agl_drawing_pattern_bmp = 0
- static int __agl_drawing_mode = DRAW_MODE_SOLID
- static double allegro_gl_projection_matrix [16]
- static double allegro_gl_modelview_matrix [16]

## Detailed Description

Allegro->OpenGL conversion vtable.

Definition in file glvtable.c.

## Define Documentation

#define DRAW_RLE_8888 | ( | bits |  | ) |

Value:

    {                               \
            for (y = 0; y < sprite->h; y++) {           \
                signed long c = *s++;               \
                for (x = 0; x < sprite->w;) {           \
                    if (c == src_mask)          \
                        break;              \
                    if (c > 0) {                \
                        /* Run of solid pixels */   \
                        for (c--; c>=0; c--) {      \
                            unsigned long col = *s++;       \
                            if (bits == 32 && trans)        \
                                _putpixel32(temp, x++, y, makeacol32(getr32(col), getg32(col), getb32(col), geta32(col))); \
                            else            \
                                _putpixel32(temp, x++, y, makeacol32(getr##bits(col), getg##bits(col), getb##bits(col), 255)); \
                        }               \
                    }                   \
                    else {                  \
                        /* Run of transparent pixels */ \
                        hline(temp, x, y, x-c+1, 0);    \
                        x -= c;             \
                    }                   \
                    c = *s++;               \
                }                       \
            }                           \
        }