13 #include <allegro/internal/aintern.h>    16 #include <OpenGL/glu.h>    21 static GLint allegro_gl_opengl_internal_texture_format = -1;
    22 static int allegro_gl_use_mipmapping_for_textures = 0;
    23 int __allegro_gl_use_alpha = FALSE;
    24 int __allegro_gl_flip_texture = TRUE;
    25 GLint __allegro_gl_texture_read_format[5];
    26 GLint __allegro_gl_texture_components[5];
    28 #define PREFIX_I                "agl-tex INFO: "    29 #define PREFIX_W                "agl-tex WARNING: "    30 #define PREFIX_E                "agl-tex ERROR: "    38 char const *__allegro_gl_get_format_description(GLint format)
    41 #define F(s) case s: return #s    55         F(GL_INTENSITY16F_ARB);
    56         F(GL_INTENSITY32F_ARB);
    62         F(GL_LUMINANCE16F_ARB);
    63         F(GL_LUMINANCE32F_ARB);
    64         F(GL_LUMINANCE_ALPHA);
    65         F(GL_LUMINANCE4_ALPHA4);
    66         F(GL_LUMINANCE12_ALPHA4);
    67         F(GL_LUMINANCE8_ALPHA8);
    68         F(GL_LUMINANCE6_ALPHA2);
    69         F(GL_LUMINANCE12_ALPHA12);
    70         F(GL_LUMINANCE16_ALPHA16);
    71         F(GL_LUMINANCE_ALPHA16F_ARB);
    72         F(GL_LUMINANCE_ALPHA32F_ARB);
    94     uszprintf(str, 
sizeof str, 
"%x", format);
   111 int __allegro_gl_get_num_channels(GLenum format) {
   120     case GL_ALPHA16F_ARB:
   121     case GL_ALPHA32F_ARB:
   127     case GL_INTENSITY16F_ARB:
   128     case GL_INTENSITY32F_ARB:
   134     case GL_LUMINANCE16F_ARB:
   135     case GL_LUMINANCE32F_ARB:
   138     case GL_LUMINANCE_ALPHA:
   139     case GL_LUMINANCE4_ALPHA4:
   140     case GL_LUMINANCE12_ALPHA4:
   141     case GL_LUMINANCE8_ALPHA8:
   142     case GL_LUMINANCE6_ALPHA2:
   143     case GL_LUMINANCE12_ALPHA12:
   144     case GL_LUMINANCE16_ALPHA16:
   145     case GL_LUMINANCE_ALPHA16F_ARB:
   146     case GL_LUMINANCE_ALPHA32F_ARB:
   190 GLint __allegro_gl_get_texture_format_ex(BITMAP *bmp, 
int flags) {
   196     switch (bitmap_color_depth(bmp)) {
   206             return GL_INTENSITY8;
   208             if (flags & AGL_TEXTURE_FORCE_ALPHA_INTERNAL) {
   216             if (flags & AGL_TEXTURE_FORCE_ALPHA_INTERNAL) {
   250     if (bmp && allegro_gl_opengl_internal_texture_format == -1) {
   251         return __allegro_gl_get_texture_format_ex(bmp,
   252                 __allegro_gl_use_alpha ? AGL_TEXTURE_FORCE_ALPHA_INTERNAL : 0);
   255     return allegro_gl_opengl_internal_texture_format;
   284     GLint old = allegro_gl_opengl_internal_texture_format;
   285     allegro_gl_opengl_internal_texture_format = format;
   311 GLenum __allegro_gl_get_bitmap_type(BITMAP *bmp, 
int flags) {
   313     int c = bitmap_color_depth(bmp);
   318             return __allegro_gl_texture_read_format[0];
   321             return __allegro_gl_texture_read_format[1];
   324             return __allegro_gl_texture_read_format[2];
   327             return __allegro_gl_texture_read_format[3];
   330             return __allegro_gl_texture_read_format[4];
   333             TRACE(PREFIX_E 
"get_bitmap_type: unhandled bitmap depth: %d\n",
   355 GLenum __allegro_gl_get_bitmap_color_format(BITMAP *bmp, 
int flags) {
   357     int c = bitmap_color_depth(bmp);
   366                 return __allegro_gl_texture_components[0];
   370             if (flags & AGL_TEXTURE_FORCE_ALPHA_INTERNAL) {
   374                 return __allegro_gl_texture_components[1];
   378             return __allegro_gl_texture_components[2];
   381             return __allegro_gl_texture_components[3];
   385                        | AGL_TEXTURE_FORCE_ALPHA_INTERNAL)) {
   389                 return __allegro_gl_texture_components[4];
   393             TRACE(PREFIX_E 
"get_bitmap_color_format: unhandled bitmap "   417     int old = allegro_gl_use_mipmapping_for_textures;
   418     allegro_gl_use_mipmapping_for_textures = enable;
   441     int old = __allegro_gl_use_alpha;
   442     __allegro_gl_use_alpha = enable;
   466     int old = __allegro_gl_flip_texture;
   467     __allegro_gl_flip_texture = enable;
   496                                    GLint internal_format) {
   499                                        bmp, internal_format) ? TRUE : FALSE);
   505 static int __allegro_gl_convert_flags(
int flags) {
   509     if (allegro_gl_use_mipmapping_for_textures) {
   512     if (__allegro_gl_use_alpha) {
   515     if (__allegro_gl_flip_texture) {
   519     if (allegro_gl_opengl_internal_texture_format == GL_ALPHA4
   520      || allegro_gl_opengl_internal_texture_format == GL_ALPHA8
   521      || allegro_gl_opengl_internal_texture_format == GL_ALPHA12
   522      || allegro_gl_opengl_internal_texture_format == GL_ALPHA16
   523      || allegro_gl_opengl_internal_texture_format == GL_ALPHA
   524      || allegro_gl_opengl_internal_texture_format == GL_INTENSITY4
   525      || allegro_gl_opengl_internal_texture_format == GL_INTENSITY8
   526      || allegro_gl_opengl_internal_texture_format == GL_INTENSITY12
   527      || allegro_gl_opengl_internal_texture_format == GL_INTENSITY16
   528      || allegro_gl_opengl_internal_texture_format == GL_INTENSITY
   529      || allegro_gl_opengl_internal_texture_format == 1) {
   559     int flags = __allegro_gl_convert_flags(0);
   562                                      allegro_gl_opengl_internal_texture_format);
   568 static int log2i(
int n) {
   596 BITMAP *__allegro_gl_munge_bitmap(
int flags, BITMAP *bmp, 
int x, 
int y,
   597                                   int w, 
int h, GLint *type, GLint *format) {
   599     BITMAP *ret = 0, *temp = 0;
   601     int need_rescale = 0;
   604     int depth = bitmap_color_depth(bmp);
   607     const int old_w = w, old_h = h;
   617          && ((w & (w - 1)) || (h & (h - 1)))) {
   618             w = __allegro_gl_make_power_of_2(w);
   619             h = __allegro_gl_make_power_of_2(h);
   620             TRACE(PREFIX_I 
"munge_bitmap: Rescaling bitmap from "   621                   "%ix%i to %ix%i due to non-power-of-2 source size.\n",
   627         if (w > allegro_gl_info.max_texture_size) {
   628             w = allegro_gl_info.max_texture_size;
   629             TRACE(PREFIX_I 
"munge_bitmap: Rescaling bitmap from "   630                   "%ix%i to %ix%i due to max supported size exceed.\n",
   635         if (h > allegro_gl_info.max_texture_size) {
   636             h = allegro_gl_info.max_texture_size;
   637             TRACE(PREFIX_I 
"munge_bitmap: Rescaling bitmap from "   638                   "%ix%i to %ix%i due to max supported size exceed.\n",
   650           && (w > 32 || h > 32)) {
   655             TRACE(PREFIX_I 
"munge_bitmap: Rescaling bitmap from "   656                   "%ix%i to %ix%i due to Voodoo driver bug.\n",
   676         if (w != h && MAX(wl, hl) > 3 && depth < 24
   678             TRACE(PREFIX_I 
"munge_bitmap: G200 path in use.\n");
   692         TRACE(PREFIX_W 
"munge_bitmap: using temporary 24bpp bitmap\n");
   723     if (allegro_gl_info.is_matrox_g200 && !(flags & AGL_TEXTURE_MASKED)
   725         TRACE(PREFIX_I 
"munge_bitmap: G200 path in use.\n");
   732     if (depth != bitmap_color_depth(bmp) || force_copy) {
   734         TRACE(PREFIX_I 
"munge_bitmap: Need to perform depth conversion from %i "   735               "to %i bpp.\n", bitmap_color_depth(bmp), depth);
   737         temp = create_bitmap_ex(depth, bmp->w, bmp->h);
   740             TRACE(PREFIX_E 
"munge_bitmap: Unable to create temporary bitmap "   741                   "%ix%ix%i\n", bmp->w, bmp->h, depth);
   747         if (bitmap_color_depth(bmp) == 8 && depth > 8) {
   749             for (j = 0; j < bmp->h; j++) {
   750                 for (i = 0; i < bmp->w; i++) {
   751                     int c = _getpixel(bmp, i, j);
   752                     putpixel(temp, i, j, makecol_depth(depth, c, c, c));
   757             blit(bmp, temp, 0, 0, 0, 0, bmp->w, bmp->h);
   761         *format = __allegro_gl_get_bitmap_color_format(bmp, flags);
   762         *type = __allegro_gl_get_bitmap_type(bmp, flags);
   768     if (!need_rescale && !need_alpha && !need_flip) {
   770         TRACE(PREFIX_I 
"munge_bitmap: No need for munging - returning %p\n",
   780     ret = create_bitmap_ex(depth, w, h);
   783         TRACE(PREFIX_E 
"munge_bitmap: Unable to create result bitmap "   784               "%ix%ix%i\n", w, h, depth);
   790     if (flags & AGL_TEXTURE_CHECK_VALID_INTERNAL) {
   792             destroy_bitmap(temp);
   805         TRACE(PREFIX_I 
"munge_bitmap: Flipping bitmap.\n");
   806         for (i = 0; i < bmp->h/2; i++) {
   807             unsigned char *l = bmp->line[i];
   808             bmp->line[i] = bmp->line[bmp->h - i - 1];
   809             bmp->line[bmp->h - i - 1] = l;
   815         TRACE(PREFIX_I 
"munge_bitmap: Rescaling bitmap.\n");
   816         stretch_blit(bmp, ret, x, y, old_w, old_h, 0, 0, ret->w, ret->h);
   819         TRACE(PREFIX_I 
"munge_bitmap: Copying bitmap.\n");
   820         blit(bmp, ret, x, y, 0, 0, w, h);
   824     if (need_flip && !temp) {
   826         TRACE(PREFIX_I 
"munge_bitmap: Unflipping bitmap.\n");
   827         for (i = 0; i < bmp->h/2; i++) {
   828             unsigned char *l = bmp->line[i];
   829             bmp->line[i] = bmp->line[bmp->h - i - 1];
   830             bmp->line[bmp->h - i - 1] = l;
   837         int mask = bitmap_mask_color(ret);
   840         int alpha = (-1) ^ makecol_depth(depth, 255, 255, 255);
   842         TRACE(PREFIX_I 
"munge_bitmap: Inserting alpha channel.\n");
   844         for (j = 0; j < h; j++) {
   845             for (i = 0; i < w; i++) {
   850                     pix = _getpixel32(ret, i, j);
   855                     else if ((flags & AGL_TEXTURE_HAS_ALPHA) == 0) {
   860                         pix = makeacol32(r, g, b, 255);
   862                     _putpixel32(ret, i, j, pix);
   865                     pix = _getpixel16(ret, i, j);
   874                     _putpixel16(temp, i, j, pix);
   887         destroy_bitmap(temp);
   897 static GLuint do_texture_upload(BITMAP *bmp, GLuint tex, GLint internal_format,
   898                               GLint format, GLint type, 
int flags) {
   900     int bytes_per_pixel = BYTES_PER_PIXEL(bitmap_color_depth(bmp));
   901     GLint saved_row_length;
   902     GLint saved_alignment;
   903     GLenum target = GL_TEXTURE_2D;
   905     glBindTexture(target, tex);
   909     if (flags & AGL_TEXTURE_CHECK_VALID_INTERNAL) { 
   913         if (allegro_gl_info.is_mesa_driver) {
   914             AGL_LOG(1, 
"* Note * check_texture: Mesa driver detected: "   915                    "PROXY_TEXTURE_2D tests are skipped\n");
   919             glTexImage2D(GL_PROXY_TEXTURE_2D, 0, internal_format,
   920                          bmp->w, bmp->h, 0, format, type, NULL);
   922             glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0,
   923                                      GL_TEXTURE_COMPONENTS, &internal_format);
   925             return (internal_format ? tex : 0);
   931     glGetIntegerv(GL_UNPACK_ROW_LENGTH, &saved_row_length);
   932     glGetIntegerv(GL_UNPACK_ALIGNMENT,  &saved_alignment);
   933     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
   935     TRACE(PREFIX_I 
"do_texture_upload: Making texture: bpp: %i\n",
   936           bitmap_color_depth(bmp));
   945             glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST);
   946             glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
   947             TRACE(PREFIX_I 
"do_texture_upload: Using SGIS_generate_mipmap for "   948                   "mipmap generation.\n");
   950         else if (allegro_gl_info.is_matrox_g200
   951              && (flags & AGL_TEXTURE_MIPMAP) && (bitmap_color_depth(bmp) >= 24
   952                 || bitmap_color_depth(bmp) == 8)
   953              && (bmp->w != bmp->h)) {
   958             TRACE(PREFIX_I 
"do_texture_upload: Using GLU for mipmaps.\n");
   959             glPixelStorei(GL_UNPACK_ROW_LENGTH, bmp->h > 1
   960                         ? (bmp->line[1] - bmp->line[0]) / bytes_per_pixel
   962             glPixelStorei(GL_UNPACK_ROW_LENGTH,
   963                                (bmp->line[1] - bmp->line[0]) / bytes_per_pixel);
   964             gluBuild2DMipmaps(GL_TEXTURE_2D, internal_format, bmp->w, bmp->h,
   965                               format, type, bmp->line[0]);
   970             int depth = bitmap_color_depth(bmp);
   977             BITMAP *temp = create_bitmap_ex(depth, w / 2, h / 2);
   982             int num_levels = log2i(MAX(bmp->w, bmp->h));
   988             TRACE(PREFIX_I 
"do_texture_upload: Using Allegro for "   989                   "mipmap generation.\n");
   992                 TRACE(PREFIX_E 
"do_texture_upload: Unable to create "   993                       "temporary bitmap sized %ix%ix%i for mipmap generation!",
   994                       w / 2, h / 2, depth);
  1002             for (i = 1; i <= num_levels; i++) {
  1004                 for (y = 0; y < h; y += 2) {
  1005                     for (x = 0; x < w; x += 2) {
  1011                         pix[0] = getpixel(src, x,     y);
  1012                         pix[1] = getpixel(src, x + 1, y);
  1013                         pix[2] = getpixel(src, x,     y + 1);
  1014                         pix[3] = getpixel(src, x + 1, y + 1);
  1026                             avg = (pix[0] + pix[1] + pix[2] + pix[3] + 2) / 4;
  1029                             r = (getr_depth(depth, pix[0])
  1030                                + getr_depth(depth, pix[1])
  1031                                + getr_depth(depth, pix[2])
  1032                                + getr_depth(depth, pix[3]) + 2) / 4;
  1033                             g = (getg_depth(depth, pix[0])
  1034                                + getg_depth(depth, pix[1])
  1035                                + getg_depth(depth, pix[2])
  1036                                + getg_depth(depth, pix[3]) + 2) / 4;
  1037                             b = (getb_depth(depth, pix[0])
  1038                                + getb_depth(depth, pix[1])
  1039                                + getb_depth(depth, pix[2])
  1040                                + getb_depth(depth, pix[3]) + 2) / 4;
  1041                             a = (geta_depth(depth, pix[0])
  1042                                + geta_depth(depth, pix[1])
  1043                                + geta_depth(depth, pix[2])
  1044                                + geta_depth(depth, pix[3]) + 2) / 4;
  1046                             avg = makeacol_depth(depth, r, g, b, a);
  1049                         putpixel(dest, x / 2, y / 2, avg);
  1060                 TRACE(PREFIX_I 
"do_texture_upload: Unpack row length: %li.\n",
  1062                      ? (
long int)((temp->line[1] - temp->line[0]) / bytes_per_pixel)
  1065                 glPixelStorei(GL_UNPACK_ROW_LENGTH, temp->h > 1
  1066                              ? (temp->line[1] - temp->line[0]) / bytes_per_pixel
  1069                 glTexImage2D(GL_TEXTURE_2D, i, internal_format,
  1070                              w, h, 0, format, type, temp->line[0]);
  1072                 TRACE(PREFIX_I 
"do_texture_upload: Mipmap level: %i, "  1073                       "size: %i x %i\n", i, w, h);
  1075                 TRACE(PREFIX_I 
"do_texture_upload: Uploaded texture: level %i, "  1076                       "internalformat: %s, %ix%i, format: 0x%x, type: 0x%x."  1077                       "\n", i, __allegro_gl_get_format_description(internal_format),
  1078                       bmp->w, bmp->h, format, type);
  1081             destroy_bitmap(temp);
  1085     glPixelStorei(GL_UNPACK_ROW_LENGTH, (bmp->h > 1)
  1086                  ? (bmp->line[1] - bmp->line[0]) / bytes_per_pixel
  1089     TRACE(PREFIX_I 
"do_texture_upload: Unpack row length: %li.\n",
  1090       (bmp->h > 1) ? (
long int)((bmp->line[1] - bmp->line[0]) / bytes_per_pixel)
  1095     glTexImage2D(GL_TEXTURE_2D, 0, internal_format,
  1096                  bmp->w, bmp->h, 0, format, type, bmp->line[0]);
  1098     TRACE(PREFIX_I 
"do_texture_upload: Uploaded texture: level 0, "  1099           "internalformat: %s, %ix%i, format: 0x%x, type: 0x%x.\n",
  1100           __allegro_gl_get_format_description(internal_format),
  1101           bmp->w, bmp->h, format, type);
  1103     TRACE(PREFIX_I 
"do_texture_upload: GL Error code: 0x%x\n", glGetError());
  1105     if (!(flags & AGL_TEXTURE_MIPMAP)) {
  1106         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  1111     glPixelStorei(GL_UNPACK_ROW_LENGTH, saved_row_length);
  1112     glPixelStorei(GL_UNPACK_ALIGNMENT,  saved_alignment);
  1167     GLuint tex = 0, ret = 0;
  1168     BITMAP *temp = NULL;
  1175     char buf[1024] = 
"";
  1176 #   define PFLAG(name) if (flags & name) strcat(buf, #name "|");  1185     TRACE(PREFIX_I 
"make_texture_ex: flags: %s, bitmap %ix%i, %i bpp.\n", buf,
  1186           bmp ? bmp->w : 0, bmp ? bmp->h : 0,
  1187           bmp ? bitmap_color_depth(bmp) : 0);
  1188     if (internal_format == -1) {
  1189         TRACE(PREFIX_I 
"internalformat: AUTO\n");
  1192         TRACE(PREFIX_I 
"internalformat: %s\n",
  1193             __allegro_gl_get_format_description(internal_format));
  1198     if (!__allegro_gl_valid_context)
  1205     glGetIntegerv(GL_TEXTURE_2D_BINDING, &old_tex);
  1209     if ((bmp->w > 32 || bmp->h > 32) && (allegro_gl_info.is_voodoo)) {
  1212             TRACE(PREFIX_I 
"make_texture_ex: Voodoo card detected && texture "  1213                   "size > 32 texels && no rescaling. Disabling mipmaps.\n");
  1219     if (bmp->w > allegro_gl_info.max_texture_size
  1220      || bmp->h > allegro_gl_info.max_texture_size) {
  1222             TRACE(PREFIX_I 
"make_texture_ex: Max texture size exceeded but no "  1223                   "rescaling allowed. Returning 0 (unsupported).\n");
  1229     if (((bmp->w & (bmp->w - 1)) || (bmp->h & (bmp->h - 1)))
  1232         TRACE(PREFIX_I 
"make_texture_ex: Non-power-of-2 sized bitmap provided, "  1233               "no rescaling allowed, and ARB_texture_non_power_of_two "  1234               "unsupported. Returning 0 (unsupported).\n");
  1240     format = __allegro_gl_get_bitmap_color_format(bmp, flags);
  1241     type = __allegro_gl_get_bitmap_type(bmp, flags);
  1244         type   = GL_UNSIGNED_BYTE;
  1245         if (internal_format == GL_ALPHA || internal_format == GL_ALPHA4
  1246          || internal_format == GL_ALPHA8) {
  1249         else if (internal_format == GL_INTENSITY
  1250               || internal_format == GL_INTENSITY4
  1251               || internal_format == GL_INTENSITY8) {
  1254         else if (internal_format == GL_LUMINANCE
  1255               || internal_format == GL_LUMINANCE4
  1256               || internal_format == GL_LUMINANCE8) {
  1257             format = GL_LUMINANCE;
  1261         if (bitmap_color_depth(bmp) != 8) {
  1267         flags |= AGL_TEXTURE_FORCE_ALPHA_INTERNAL;
  1270     TRACE(PREFIX_I 
"make_texture_ex: Preselected texture format: %s, "  1271           "type: 0x%x\n", __allegro_gl_get_format_description(format), type);
  1274     temp = __allegro_gl_munge_bitmap(flags, bmp, 0, 0, bmp->w, bmp->h,
  1280     if (internal_format == -1) {
  1281         internal_format = __allegro_gl_get_texture_format_ex(bmp, flags);
  1282         TRACE(PREFIX_I 
"make_texture_ex: Picked internalformat: %s\n",
  1283               __allegro_gl_get_format_description(internal_format));
  1286     if (internal_format == -1) {
  1287         TRACE(PREFIX_E 
"make_texture_ex: Invalid internal format!: "  1288               "%s\n", __allegro_gl_get_format_description(internal_format));
  1292     TRACE(PREFIX_I 
"make_texture_ex: dest format=%s, source format=%s, "  1293           "type=0x%x\n", __allegro_gl_get_format_description(internal_format),
  1294               __allegro_gl_get_format_description(format), (
int)type);
  1303      && internal_format == GL_RGB8
  1307         int depth = bitmap_color_depth(bmp);
  1309         TRACE(PREFIX_I 
"make_texture_ex: ATI Radeon 7000 detected, mipmapping "  1310               "used, SGIS_generate_mipmap available and selected "  1311               "internalformat is GL_RGB8 but format is GL_RGBA. Working around "  1312               "ATI driver bug by upgrading bitmap to 32-bpp and using GL_RGBA8 "  1319                 temp = create_bitmap_ex(depth, bmp->w, bmp->h);
  1321                     TRACE(PREFIX_E 
"make_texture_ex: Unable to allocate "  1322                           "memory for temporary bitmap (Radeon 7000 path)!\n");
  1325                 blit(bmp, temp, 0, 0, 0, 0, bmp->w, bmp->h);
  1335             for (j = 0; j < bmp->h; j++) {
  1336                 for (i = 0; i < bmp->w; i++) {
  1337                     int pix = _getpixel32(bmp, i, j);
  1338                     _putpixel32(bmp, i, j,
  1339                         makeacol32(getr32(pix), getg32(pix), getb32(pix), 255));
  1343         internal_format = GL_RGBA8;
  1348     glGenTextures(1, &tex);
  1350         TRACE(PREFIX_E 
"make_texture_ex: Unable to create GL texture!\n");
  1354     ret = do_texture_upload(bmp, tex, internal_format, format, type, flags);
  1358         destroy_bitmap(temp);
  1362         glDeleteTextures(1, &tex);
  1365     glBindTexture(GL_TEXTURE_2D, old_tex);
  1385     int flags = __allegro_gl_convert_flags(0);
  1388                                      allegro_gl_opengl_internal_texture_format);
  1407                                      allegro_gl_opengl_internal_texture_format);
  1435     int flags = __allegro_gl_convert_flags(0);
  1436     return __allegro_gl_get_bitmap_type(bmp, flags);
  1458     int flags = __allegro_gl_convert_flags(0);
  1459     return __allegro_gl_get_bitmap_color_format(bmp, flags);
 #define AGL_TEXTURE_MASKED
Generate an alpha channel for this texture, based on the Allegro mask color. 
 
GLuint allegro_gl_make_texture_ex(int flags, BITMAP *bmp, GLint internal_format)
Uploads an Allegro BITMAP to the GL driver as a texture. 
 
GLint allegro_gl_get_texture_format(BITMAP *bmp)
Returns the OpenGL internal texture format for this bitmap. 
 
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_use_mipmapping(int enable)
Tell AllegroGL to use Mipmapping or not when generating textures via its functions. 
 
#define AGL_TEXTURE_ALPHA_ONLY
Tell AllegroGL that the specified BITMAP is an 8-bpp alpha-only BITMAP. 
 
struct AGL_EXTENSION_LIST_GL allegro_gl_extensions_GL
List of OpenGL extensions supported by AllegroGL. 
 
GLint allegro_gl_set_texture_format(GLint format)
Sets the color format you'd like OpenGL to use for its textures. 
 
int allegro_gl_check_texture(BITMAP *bmp)
Checks whether the specified bitmap is of the proper size for texturing. 
 
int allegro_gl_flip_texture(int enable)
Tell AllegroGL to flip the texture vertically or not when generating textures via its functions...
 
GLenum allegro_gl_get_bitmap_color_format(BITMAP *bmp)
AllegroGL will generate mipmaps for this texture. 
 
GLuint allegro_gl_make_masked_texture(BITMAP *bmp)
Uploads an Allegro BITMAP to the GL driver as a texture. 
 
#define AGL_TEXTURE_MIPMAP
AllegroGL will generate mipmaps for this texture. 
 
Main header file for AllegroGL. 
 
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. 
 
#define AGL_TEXTURE_FLIP
Flip the texture on the x-axis. 
 
GLuint allegro_gl_make_texture(BITMAP *bmp)
Uploads an Allegro BITMAP to the GL driver as a texture. 
 
#define AGL_TEXTURE_RESCALE
Tell AllegroGL to allow rescaling of the bitmap. 
 
#define AGL_TEXTURE_HAS_ALPHA
Tell AllegroGL that the bitmap had an alpha channel, so it should be preserved when generating the te...
 
GLenum allegro_gl_get_bitmap_type(BITMAP *bmp)
AllegroGL will generate mipmaps for this texture.