AllegroGL 0.4.4
|
AllegroGL provides functions to allow using Allegro BITMAP objects to be used as OpenGL textures. More...
AllegroGL provides functions to allow using Allegro BITMAP objects to be used as OpenGL textures.
#define AGL_TEXTURE_FLIP 0x04 |
Flip the texture on the x-axis.
OpenGL uses the bottom-left corner of the texture as (0,0), so if you need your texture to be flipped to make (0,0) the top-left corner, you need to use this flag.
Definition at line 529 of file alleggl.h.
Referenced by allegro_gl_convert_allegro_font_ex().
#define AGL_TEXTURE_MASKED 0x08 |
Generate an alpha channel for this texture, based on the Allegro mask color.
Make sure the target format supports an alpha channel.
Definition at line 534 of file alleggl.h.
Referenced by allegro_gl_convert_allegro_font_ex().
#define AGL_TEXTURE_RESCALE 0x10 |
int allegro_gl_use_mipmapping | ( | int | enable | ) |
Tell AllegroGL to use Mipmapping or not when generating textures via its functions.
This will not affect outside OpenGL states. Default is FALSE (off).
enable | Set to TRUE to enable mipmapping, FALSE otherwise. |
int allegro_gl_use_alpha_channel | ( | int | enable | ) |
Tell AllegroGL to use Alpha channel or not when generating textures via its functions.
This will not affect outside OpenGL states. Default is FALSE (off).
enable | Set to TRUE to enable textures with alpha channel, FALSE otherwise. |
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).
Default is TRUE (on).
enable | Set to TRUE to enable textures with alpha channel, FALSE otherwise. |
int allegro_gl_check_texture | ( | BITMAP * | bmp | ) |
Checks whether the specified bitmap is of the proper size for texturing.
This checks for the card's limit on texture sizes.
Important note: allegro_gl_check_texture does not depend on the current state of the texture memory of the driver. This function may return TRUE although there is not enough memory to currently make the texture resident. You may check if the texture is actually resident with glAreTexturesResident().
bmp | The bitmap to be converted to a texture. |
Definition at line 557 of file texture.c.
References allegro_gl_check_texture_ex().
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.
This checks for the card's limit on texture sizes.
The parameters to this function are identical to those of allegro_gl_make_texture_ex().
Important note: allegro_gl_check_texture does not depend on the current state of the texture memory of the driver. This function may return TRUE although there is not enough memory to currently make the texture resident. You may check if the texture is actually resident with glAreTexturesResident().
flags | The bitmap conversion flags. |
bmp | The bitmap to be converted to a texture. |
internal_format | The internal format to convert to. |
Definition at line 495 of file texture.c.
References allegro_gl_make_texture_ex().
Referenced by allegro_gl_check_texture(), and allegro_gl_convert_allegro_font_ex().
GLint allegro_gl_get_texture_format | ( | BITMAP * | bmp | ) |
Returns the OpenGL internal texture format for this bitmap.
If left to default, it returns the number of color components in the bitmap. Otherwise, it simply returns the user defined value. If the bitmap parameter is NULL, then it returns the currently set format, or -1 if none were previously set. 8 bpp bitmaps are assumed to be alpha channels only (GL_ALPHA8) by default.
bmp | The bitmap to get the information of. |
Definition at line 248 of file texture.c.
Referenced by allegro_gl_convert_allegro_font().
GLint allegro_gl_set_texture_format | ( | GLint | format | ) |
Sets the color format you'd like OpenGL to use for its textures.
You can pass any of the available GL_* constants that describe the internal format (GL_ALPHA4...GL_RGBA16). It is recommended that you check for the availability of the format from the client, using allegro_gl_opengl_version(). No checking will be done as to the validity of the format. The format is a recommendation to the driver, so there is no guarentee that the actual format used will be the one you chose - this is implementation dependant. This call will affect all subsequent calls to allegro_gl_make_texture() and allegro_gl_make_masked_texture().
To revert to the default AllegroGL format, pass -1 as the format.
format | The OpenGL internal texture format. |
GLuint allegro_gl_make_texture | ( | BITMAP * | bmp | ) |
Uploads an Allegro BITMAP to the GL driver as a texture.
Definition at line 1383 of file texture.c.
References allegro_gl_make_texture_ex().
GLuint allegro_gl_make_masked_texture | ( | BITMAP * | bmp | ) |
Uploads an Allegro BITMAP to the GL driver as a texture.
Definition at line 1402 of file texture.c.
References allegro_gl_make_texture_ex().
GLuint allegro_gl_make_texture_ex | ( | int | flags, |
BITMAP * | bmp, | ||
GLint | internal_format | ||
) |
Uploads an Allegro BITMAP to the GL driver as a texture.
The bitmap must be a memory bitmap (note that it can be a subbitmap).
Each bitmap will be converted to a single texture object, with all its size limitations imposed by the video driver and hardware.
The bitmap should conform to the size limitations imposed by the video driver. That is, if ARB_texture_non_power_of_two is not supported, then the BITMAP must be power-of-two sized. Otherwise, AllegroGL will pick the best format for the bitmap.
The original bitmap will NOT be modified.
The flags parameter controls how the texture is generated. It can be a logical OR (|) of any of the following:
AGL_TEXTURE_MIPMAP AGL_TEXTURE_HAS_ALPHA AGL_TEXTURE_FLIP AGL_TEXTURE_MASKED AGL_TEXTURE_RESCALE
AllegroGL will create a texture with the specified texel format. The texel format should be any of the valid formats that can be specified to glTexImage2D(). No validity checks will be performed by AllegroGL. If you want AllegroGL to automatically determine the format to use based on the BITMAP, use -1 as the format specifier.
A valid GL Rendering Context must have been established, which means you cannot use this function before having called set_gfx_mode() with a valid OpenGL mode.
Important note: on 32 bit bitmap in RGBA mode, the alpha channel created by Allegro is set to all 0 by default. This will cause the texture to not show up in 32bpp modes if alpha is set. You will need to fill in the alpha channel manually if you need an alpha channel.
bmp | The bitmap to be converted to a texture. |
flags | The conversion flags. |
internal_format | The texture format to convert to. |
Definition at line 1165 of file texture.c.
References allegro_gl_extensions_GL.
Referenced by allegro_gl_check_texture_ex(), allegro_gl_convert_allegro_font_ex(), allegro_gl_make_masked_texture(), and allegro_gl_make_texture().