You can also load system fonts (such as Arial and Courrier) and draw using those. Allegro FONTs should still work if you use textout, textprintf, etc on them. However, converted Allegro FONTs will not work with these functions. You will have to use AllegroGL functions to work with AllegroGL FONTs.
|
Indicates that you don't really care how a font will be converted. AGL will pick the best format for you. Definition at line 580 of file alleggl.h. Referenced by allegro_gl_convert_allegro_font_ex(). |
|
Indicates that you want fonts to be converted to a bitmap format. Bitmaps are used to represent characters with one bit per pixel, and are usually very slow to draw, as they stall the 3D pipeline. Note that you can't scale, rotate or place text with a z coordinate if you use this style. A display list will be created.
Definition at line 591 of file alleggl.h. Referenced by agl_char_length_fractional(), allegro_gl_destroy_font(), and allegro_gl_printf_ex(). |
|
Indicates that you want fonts to be converted to an outline format. Outlined mode is a vector-style font. Characters are represented by a set of polygons and lines. This style of fonts is fast to draw, and can be scaled, rotated, etc, since they are just vectors. A display list will be created.
Definition at line 603 of file alleggl.h. Referenced by allegro_gl_convert_allegro_font_ex(), allegro_gl_destroy_font(), allegro_gl_load_system_font(), and allegro_gl_printf_ex(). |
|
Indicates that you want fonts to be converted to a texture format. Each character is represented by a textured quad. The texture is common for all characters of the same font, and it will automatically be uploaded to the video card when needed. Drawing text with this type of font is the fastest since only two triangles are needed per character. Textured text can also be scaled and rotated. A display list will be created.
Definition at line 615 of file alleggl.h. Referenced by agl_char_length_fractional(), aglf_convert_allegro_font_to_texture(), allegro_gl_convert_allegro_font_ex(), allegro_gl_destroy_font(), and allegro_gl_printf_ex(). |
|
Creates a font with bold characters. System fonts only.
|
|
Creates a font with black (strong bold) characters. System fonts only.
|
|
Creates a font with italicized characters. System fonts only.
|
|
Creates a font with underlined characters. System fonts only.
|
|
Creates a font with striked out characters. System fonts only.
|
|
Creates a font with anti-aliased characters. System fonts only. Anti-aliasing may not be available, and no error will be reported if such is the case.
|
|
Font generation mode. System fonts only. Indicates that you want outline system fonts to be generated using polygons.
|
|
Font generation mode. System fonts only. Indicates that you want outline system fonts to be generated using lines.
|
|
Equivalent to:.
r = getr(color); g = getg(color); b = getb(color); a = geta(color); glColor4f(r, g, b, a); allegro_gl_printf_ex(f, x, y, z, format, ...); Note that the current primary color is not preserved. Definition at line 63 of file aglf.c. References __allegro_gl_use_alpha, __allegro_gl_valid_context, and allegro_gl_printf_ex(). |
|
Prints a formatted string (printf style) on the screen.
Texturing must be enabled for this function to work with AGL_FONT_TYPE_TEXTURED fonts.
Remember to use The resulting size may not be what you expect. For bitmaped fonts, there is nothing you can do about this appart changing the font itself. Textured and Vector fonts are more flexible, in that you can use glScale to adjust the size of the characters. If you need to draw the text without the black backround, we suggest you set up a proper blending mode prior to drawing the text, such as: glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); If you want to emulate the Allegro drawing mode (no blending at all), then you should use the folowing code instead:
glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND);
glBlendFunc(GL_DST_COLOR, GL_ZERO); allegro_gl_printf();
glBlendFunc(GL_ONE, GL_ONE); allegro_gl_printf(); // Same as the one above!
glEnable(GL_DEPTH_TEST); Have a look at NeHe's Tutorial #20 for details on this technique. http://nehe.gamedev.net/
The most flexible way to use fonts, though, is to use alpha textures based on a greyscale font. Set the texture format to
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); allegro_gl_printf_ex(my_font, x, y, z, "Hi!")
Definition at line 165 of file aglf.c. References __allegro_gl_valid_context, AGL_FONT_TYPE_BITMAP, AGL_FONT_TYPE_OUTLINE, AGL_FONT_TYPE_TEXTURED, allegro_gl_begin, allegro_gl_end, find_range(), and font_vtable_agl. Referenced by allegro_gl_printf(). |
|
Equivalent to:.
allegro_gl_convert_allegro_font_ex(f, type, scale, format_state); Where format_state is the last specified format to allegro_gl_set_texture_format(). If allegro_gl_set_texture_format() was not previously called, AllegroGL will try to determine the texture format automatically.
Definition at line 628 of file fontconv.c. References allegro_gl_convert_allegro_font_ex(), and allegro_gl_get_texture_format(). |
|
Converts a regular Allegro FONT to the AGL format for 3D display.
You can't convert an Allegro font to a vector font (AGL_FONT_TYPE_OUTLINE) as the logistics of such an operation are quite complex. The original font will NOT be modified. A valid OpenGL rendering context is required, so you may only call this function after a successful call to set_gfx_mode() with a valid OpenGL mode. You should destroy the font via allegro_gl_destroy_font() when you are done with it. Scaling For AGL_FONT_TYPE_TEXTURED fonts, glyphs in the font need to be mapped to OpenGL coordinates. The scale factor ensures that you get the scaling you need. scale reprents the number of pixels to be mapped to 1.0 OpenGL units. For allegro_gl_convert_font() to behave like AllegroGL 0.0.24 and earlier, you'll need to pass 16.0 as the scale factor. Alternativaly, you can make all your fonts be 1.0 units high by using: allegro_gl_convert_allegro_font(f, AGL_FONT_TYPE_TEXTURED, 1.0/font_height(f)); If you are planning to use your fonts on an orthographic projection where one unit maps to one pixel, then you should pass 1.0 as scale. The scaling factor has no meaning for AGL_FONT_TYPE_BITMAP fonts, so it's ignored if the conversion will lead to a font of that type. Format The format specifies what internal format OpenGL should use for the texture, in the case of AGL_FONT_TYPE_TEXTURED fonts. It has the same semantics as the internalformat parameter of glTexImage2D(). If you would like for AllegroGL to pick a texture format for you, you may supply -1 as the texture format. The default format for monochrome fonts is GL_INTENSITY4. The default format for colored fonts is GL_RGB8.
Definition at line 690 of file fontconv.c. References __allegro_gl_valid_context, AGL_FONT_TYPE_DONT_CARE, AGL_FONT_TYPE_OUTLINE, AGL_FONT_TYPE_TEXTURED, FONT_AGL_DATA::data, font_vtable_agl, FONT_AGL_DATA::next, and FONT_AGL_DATA::type. Referenced by allegro_gl_convert_allegro_font(). |
|
Set the font generation mode for system fonts. Note: This function is deprecated and will be removed in a future version.
Definition at line 469 of file aglf.c. References aglf_font_generation_mode. |
|
Short hand for aglf_load_system_font_ex(name, AGL_FONT_TYPE_OUTLINE, style, w, h, 0.0f, 32, 256). Note: This function is deprecated and will be removed in a future version.
Definition at line 485 of file aglf.c. References AGL_FONT_TYPE_OUTLINE, and allegro_gl_load_system_font_ex(). |
|
Loads a system font. Note: This function is deprecated and will be removed in a future version.
Definition at line 526 of file aglf.c. References __allegro_gl_valid_context. Referenced by allegro_gl_load_system_font(). |
|
Destroys the font.
You cannot use that font anymore after calling this function. It's safe to call this function with a NULL pointer; a note will be placed in allegro.log if DEBUGMODE was defined. If NULL is passed as the font to destroy, then this function returns immediately. Definition at line 571 of file aglf.c. References __allegro_gl_valid_context, AGL_FONT_TYPE_BITMAP, AGL_FONT_TYPE_OUTLINE, AGL_FONT_TYPE_TEXTURED, FONT_AGL_DATA::data, FONT_AGL_DATA::end, font_vtable_agl, FONT_AGL_DATA::glyph_coords, FONT_AGL_DATA::is_free_chunk, FONT_AGL_DATA::list_base, FONT_AGL_DATA::next, FONT_AGL_DATA::start, FONT_AGL_DATA::texture, and FONT_AGL_DATA::type. |
|
List the texture ID of all textures forming the specified font. The font specified must be an AllegroGL font. If ids is not NULL, then the ID numbers of all textures used by the font are written to the GLuint array pointed by ids. The size of that array is specified by the max_num_id parameter. This function will never write more than 'max_num_id' values in the ids array. If f is NULL, then zero is returned and the ids array is never touched. If the font does not contain any textures (because it is a bitmap or outline font, for example), then zero is returned.
int num_ids = allegro_gl_list_font_textures(font, NULL, 0);
GLuint *id = malloc(sizeof(GLuint) * num_ids);
if (!id) { //handle error }
allegro_gl_list_font_textures(font, id, num_ids);
for (i = 0; i < num_ids; i++) { glBindTexture(GL_TEXTURE_2D, id[i]); // Use this texture }
free(id);
GLint id[10]; // Reserve a safe number GLint num_ids = allegro_gl_list_font_textures(font, id, 10); Definition at line 687 of file aglf.c. References __allegro_gl_valid_context, FONT_AGL_DATA::data, font_vtable_agl, FONT_AGL_DATA::next, and FONT_AGL_DATA::texture. |