#include <gls_font_renderer.h>
|
unsigned char | TextureMinFilter () |
|
void | TextureMinFilter (unsigned char val) |
|
unsigned char | TextureMagFilter () |
|
void | TextureMagFilter (unsigned char val) |
|
void | SetFont (const GlsFontBase *font) |
|
void | InitRendering (unsigned char textureMinFilter, unsigned char textureMagFilter) |
|
void | InitRendering () |
|
void | TermRendering () |
|
void | DrawCharacter (const bool emphasize, const float emphasisOffset, const bool inverse, const GLfloat x1, const GLfloat y1, const GLfloat x2, const GLfloat y2, const GLfloat tx1, const GLfloat ty1, const GLfloat tx2, const GLfloat ty2) const |
|
void | DrawCharacter (const bool emphasize, const float emphasisOffset, const GLfloat x1, const GLfloat y1, const GLfloat x2, const GLfloat y2, const GLfloat tx1, const GLfloat ty1, const GLfloat tx2, const GLfloat ty2) const |
|
void | DrawHalo (const float haloOffset, const float diagonalOffset, const GLfloat x1, const GLfloat y1, const GLfloat x2, const GLfloat y2, const GLfloat tx1, const GLfloat ty1, const GLfloat tx2, const GLfloat ty2) const |
|
void | DrawShadow (const float shadowOffset, const GLfloat x1, const GLfloat y1, const GLfloat x2, const GLfloat y2, const GLfloat tx1, const GLfloat ty1, const GLfloat tx2, const GLfloat ty2) const |
|
| GlsFontRenderer (const GlsFontBase *font) |
|
|
static void | MapTexture (const GLfloat x1, const GLfloat y1, const GLfloat x2, const GLfloat y2, const GLfloat tx1, const GLfloat ty1, const GLfloat tx2, const GLfloat ty2) |
|
The GlsFontRenderer object can be used to render characters from a GlsFontBase in Open GL at specific locations and with several different text effects. Prior to rendering any characters, InitRendering must be invoked to set up the proper drawing environment. Then call Render for each character to be drawn.
- See also
- GlsFontBase
Create a GlsFontRenderer with the default settings.
- Parameters
-
font | The font to use for rendering. This may be NULL on creation, but it must be set before rendering. |
void DrawCharacter |
( |
const bool |
emphasize, |
|
|
const float |
emphasisOffset, |
|
|
const bool |
inverse, |
|
|
const GLfloat |
x1, |
|
|
const GLfloat |
y1, |
|
|
const GLfloat |
x2, |
|
|
const GLfloat |
y2, |
|
|
const GLfloat |
tx1, |
|
|
const GLfloat |
ty1, |
|
|
const GLfloat |
tx2, |
|
|
const GLfloat |
ty2 |
|
) |
| const |
|
inline |
Draws a character.
- Deprecated:
- inverse no longer has any effect, use the other overload instead.
- Parameters
-
emphasize | true if the rendered character should be emphasized. This will essentially bold the character. If a bold font is being used, the character will appear even more bolded. |
emphasisOffset | Magnitude of the emhpasis offset. A good value to try is (0.2 * character_width). |
inverse | Deprecated, has no effect |
x1 | lower left corner x coordinate of the polygon |
y1 | lower left corner y coordinate of the polygon |
x2 | upper right corner x coordinate of the polygon |
y2 | upper right corner y coordinate of the polygon |
tx1 | lower left corner x texture coordinate |
ty1 | lower left corner y texture coordinate |
tx2 | upper right corner x texture coordinate |
ty2 | upper right corner y texture coordinate |
void DrawCharacter |
( |
const bool |
emphasize, |
|
|
const float |
emphasisOffset, |
|
|
const GLfloat |
x1, |
|
|
const GLfloat |
y1, |
|
|
const GLfloat |
x2, |
|
|
const GLfloat |
y2, |
|
|
const GLfloat |
tx1, |
|
|
const GLfloat |
ty1, |
|
|
const GLfloat |
tx2, |
|
|
const GLfloat |
ty2 |
|
) |
| const |
|
inline |
Draws a character.
- Parameters
-
emphasize | true if the rendered character should be emphasized. This will essentially bold the character. If a bold font is being used, the character will appear even more bolded. |
emphasisOffset | Magnitude of the emhpasis offset. A good value to try is (0.2 * character_width). |
x1 | lower left corner x coordinate of the polygon |
y1 | lower left corner y coordinate of the polygon |
x2 | upper right corner x coordinate of the polygon |
y2 | upper right corner y coordinate of the polygon |
tx1 | lower left corner x texture coordinate |
ty1 | lower left corner y texture coordinate |
tx2 | upper right corner x texture coordinate |
ty2 | upper right corner y texture coordinate |
void DrawHalo |
( |
const float |
haloOffset, |
|
|
const float |
diagonalOffset, |
|
|
const GLfloat |
x1, |
|
|
const GLfloat |
y1, |
|
|
const GLfloat |
x2, |
|
|
const GLfloat |
y2, |
|
|
const GLfloat |
tx1, |
|
|
const GLfloat |
ty1, |
|
|
const GLfloat |
tx2, |
|
|
const GLfloat |
ty2 |
|
) |
| const |
|
inline |
Draws a halo effect for the given character.
- Parameters
-
haloOffset | Controls the size of the halo GlsTextGrid uses: (emphasize ? 0.05f : 0.03f) * (character_width) (x2 - x1) |
x1 | lower left corner x coordinate of the polygon |
y1 | lower left corner y coordinate of the polygon |
x2 | upper right corner x coordinate of the polygon |
y2 | upper right corner y coordinate of the polygon |
tx1 | lower left corner x texture coordinate |
ty1 | lower left corner y texture coordinate |
tx2 | upper right corner x texture coordinate |
ty2 | upper right corner y texture coordinate |
void DrawShadow |
( |
const float |
shadowOffset, |
|
|
const GLfloat |
x1, |
|
|
const GLfloat |
y1, |
|
|
const GLfloat |
x2, |
|
|
const GLfloat |
y2, |
|
|
const GLfloat |
tx1, |
|
|
const GLfloat |
ty1, |
|
|
const GLfloat |
tx2, |
|
|
const GLfloat |
ty2 |
|
) |
| const |
|
inline |
Draws a drop shadow effect for a character.
- Parameters
-
shadowOffset | distance to offset the shadow from the character |
x1 | lower left corner x coordinate of the polygon |
y1 | lower left corner y coordinate of the polygon |
x2 | upper right corner x coordinate of the polygon |
y2 | upper right corner y coordinate of the polygon |
tx1 | lower left corner x texture coordinate |
ty1 | lower left corner y texture coordinate |
tx2 | upper right corner x texture coordinate |
ty2 | upper right corner y texture coordinate |
void InitRendering |
( |
unsigned char |
textureMinFilter, |
|
|
unsigned char |
textureMagFilter |
|
) |
| |
|
inline |
Initializes the font to begin rendering characters. This will set up Open GL texture modes, bind the font's texture, set up minification and magnification filters, etc. This must be called once before invoking Render to draw characters. This version overwrites the texture minification and magnification filters before initializing.
- Parameters
-
textureMinFilter | Minification mode for the font texture |
textureMagFilter | Magnification mode for the font texture |
Initializes the font to begin rendering characters. This will set up Open GL texture modes, bind the font's texture, set up minification and magnification filters, etc. This must be called before using any of the Render methods draw characters.
static void MapTexture |
( |
const GLfloat |
x1, |
|
|
const GLfloat |
y1, |
|
|
const GLfloat |
x2, |
|
|
const GLfloat |
y2, |
|
|
const GLfloat |
tx1, |
|
|
const GLfloat |
ty1, |
|
|
const GLfloat |
tx2, |
|
|
const GLfloat |
ty2 |
|
) |
| |
|
inlinestatic |
Map a square piece of a texture onto a quad ( assumed to be called between glBegin(GL_QUADS)...glEnd() pair )
- Parameters
-
x1 | the lower left corner x of the quad |
y1 | the lower left corner y of the quad |
x2 | the upper right corner x of the quad |
y2 | the upper right corner of the quad |
tx1 | lower left corner x texture coordinate |
ty1 | lower left corner y texture coordinate |
tx2 | upper right corner x texture coordinate |
ty2 | upper right corner y texture coordinate |
Set the font to use. The font pointer must be set before calling any rendering methods
Helper method to set up Open GL texture modes, bind the font's texture, set up minification and magnification filters, etc.
Restores the Open GL state as it was before the call to InitRendering. This should be called after all characters have been rendered using the Render methods.
unsigned char TextureMagFilter |
( |
| ) |
|
|
inline |
Returns the magnification filter for this font
void TextureMagFilter |
( |
unsigned char |
val | ) |
|
|
inline |
Sets the magnification filter for this font
unsigned char TextureMinFilter |
( |
| ) |
|
|
inline |
Returns the minification filter for this font
void TextureMinFilter |
( |
unsigned char |
val | ) |
|
|
inline |
Sets the minification filter for this font
Current drawing color is kept so we don't have to make an OpenGL call if the color is the same
Pointer to the font to use for rendering
unsigned char _textureMagFilter |
|
protected |
Magnification mode for the font texture
unsigned char _textureMinFilter |
|
protected |
Minification mode for the font texture
The documentation for this class was generated from the following file: