40 #ifndef _GLS_FONT_RENDERER_H
41 #define _GLS_FONT_RENDERER_H
68 typedef VertexNoColor
Vector;
86 typedef GlsFontBase::Char_t Char_t;
145 unsigned char textureMinFilter,
146 unsigned char textureMagFilter
190 glDisable( GL_TEXTURE_2D );
191 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
213 const bool emphasize,
214 const float emphasisOffset,
220 const GLfloat y2 )
const
227 if( emphasize && !inverse )
229 GLfloat offsetY1( y1 + emphasisOffset );
230 GLfloat offsetY2( y2 + emphasisOffset );
232 quadStorage.
AddQuad2D( x1 - emphasisOffset, offsetY1, x2 - emphasisOffset, offsetY2 );
233 quadStorage.
AddQuad2D( x1 + emphasisOffset, offsetY1, x2 + emphasisOffset, offsetY2 );
251 const float haloOffset,
252 GlsQuadListVCT_2D& quadStorage,
256 const GLfloat y2 )
const
258 const GLfloat x1right( x1 + haloOffset );
259 const GLfloat x1left( x1 - haloOffset );
260 const GLfloat x2right( x2 + haloOffset );
261 const GLfloat x2left( x2 - haloOffset );
262 const GLfloat y1up( y1 + haloOffset );
263 const GLfloat y1down( y1 - haloOffset );
264 const GLfloat y2up( y2 + haloOffset );
265 const GLfloat y2down( y2 - haloOffset );
267 quadStorage.AddQuad2D( x1left, y1up, x2left, y2up );
268 quadStorage.AddQuad2D( x1left, y1down, x2left, y2down );
269 quadStorage.AddQuad2D( x1right, y1up, x2right, y2up );
270 quadStorage.AddQuad2D( x1right, y1down, x2right, y2down );
296 const bool emphasize,
297 const float emphasisOffset,
306 const GLfloat ty2 )
const
309 glBlendFunc( inverse ? GL_ONE_MINUS_SRC_ALPHA : GL_SRC_ALPHA,
310 inverse ? GL_SRC_ALPHA : GL_ONE_MINUS_SRC_ALPHA );
314 MapTexture( x1, y1, x2, y2, tx1, ty1, tx2, ty2 );
317 if( emphasize && !inverse )
319 GLfloat offsetY1( y1 + emphasisOffset );
320 GLfloat offsetY2( y2 + emphasisOffset );
323 x1 - emphasisOffset, offsetY1, x2 - emphasisOffset, offsetY2,
324 tx1, ty1, tx2, ty2 );
327 x1 + emphasisOffset, offsetY1, x2 + emphasisOffset, offsetY2,
328 tx1, ty1, tx2, ty2 );
349 const float haloOffset,
357 const GLfloat ty2 )
const
360 GLfloat x1right( x1 + haloOffset );
361 GLfloat x1left( x1 - haloOffset );
362 GLfloat x2right( x2 + haloOffset );
363 GLfloat x2left( x2 - haloOffset );
364 GLfloat y1up( y1 + haloOffset );
365 GLfloat y1down( y1 - haloOffset );
366 GLfloat y2up( y2 + haloOffset );
367 GLfloat y2down( y2 - haloOffset );
373 x1left, y1up, x2left, y2up,
374 tx1, ty1, tx2, ty2 );
378 x1left, y1down, x2left, y2down,
379 tx1, ty1, tx2, ty2 );
383 x1right, y1up, x2right, y2up,
384 tx1, ty1, tx2, ty2 );
388 x1right, y1down, x2right, y2down,
389 tx1, ty1, tx2, ty2 );
407 const float shadowOffset,
415 const GLfloat ty2 )
const
426 tx1, ty1, tx2, ty2 );
454 glTexCoord2f( tx1, ty1 );
455 glVertex2f( x1, y1 );
456 glTexCoord2f( tx2, ty1 );
457 glVertex2f( x2, y1 );
458 glTexCoord2f( tx2, ty2 );
459 glVertex2f( x2, y2 );
460 glTexCoord2f( tx1, ty2 );
461 glVertex2f( x1, y2 );
509 stateManager->Texture2DEnabled(
true );
510 stateManager->BindTexture( texture );
515 stateManager->SetTextureMagFilter( GL_NEAREST );
519 stateManager->SetTextureMagFilter( GL_LINEAR );
523 switch( _textureMinFilter )
526 stateManager->SetTextureMinFilter( GL_NEAREST );
530 stateManager->SetTextureMinFilter( GL_LINEAR );
534 stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_NEAREST );
538 stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_LINEAR );
542 stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_LINEAR );
546 stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_NEAREST );
550 stateManager->SetTextureEnvMode( IGlsStateManager::GLS_TEXTURE_MAP_MODE_MODULATE );
566 glColor4ubv( _currentColor.
RGBA() );
569 glEnable( GL_TEXTURE_2D );
575 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
579 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
583 switch( _textureMinFilter )
586 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
589 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
592 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
595 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
598 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR );
601 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
605 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
Definition: display_types.h:75
Definition: display_types.h:73
virtual void MipMap(bool mipMap)=0
unsigned char _textureMinFilter
Definition: gls_font_renderer.h:487
Definition: IFontImage.h:53
void SetupTexture(IFontImage *texture)
Definition: gls_font_renderer.h:556
void TextureMinFilter(unsigned char val)
Definition: gls_font_renderer.h:100
The disti::GlsFontBase class and related classes.
The disti::GlsQuadListVC_3D and GlsQuadListVCT_2D classes.
GlsColor _currentColor
Definition: gls_font_renderer.h:480
Image * Texture() const
Definition: gls_font_base.h:317
virtual void BindTexture()=0
unsigned char TextureMagFilter()
Definition: gls_font_renderer.h:106
Definition: gls_state_manager_interface.h:66
Definition: gls_quad_storage.h:156
unsigned char TextureMinFilter()
Definition: gls_font_renderer.h:94
The disti::GlsStateManager factory class. Creates an instance of a state manager that manages the GL ...
The Color class: Implements a 4 component RGBA color.
The Image class. All textures are converted internally into Images.
const GlsFontBase * _font
Definition: gls_font_renderer.h:484
VertexNoColor Vector
Definition: gls_font_base.h:66
Definition: gls_font_renderer.h:83
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
Definition: gls_font_renderer.h:295
The disti::Vertex class. A class for manipulating 3D vertices.
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
Definition: gls_font_renderer.h:406
void SetFont(const GlsFontBase *font)
Definition: gls_font_renderer.h:126
void DrawHalo(const float haloOffset, 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
Definition: gls_font_renderer.h:348
Definition: gls_color.h:53
unsigned char _textureMagFilter
Definition: gls_font_renderer.h:490
void InitRendering()
Definition: gls_font_renderer.h:178
void TermRendering()
Definition: gls_font_renderer.h:188
Definition: display_types.h:71
void TextureMagFilter(unsigned char val)
Definition: gls_font_renderer.h:112
Definition: display_types.h:74
Definition: display_types.h:70
Definition: display_types.h:72
void AddQuad2D(const float x1, const float y1, const float x2, const float y2)
Character attributes. One item for each character in the set.
Definition: gls_font_base.h:124
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)
Definition: gls_font_renderer.h:444
void InitRendering(unsigned char textureMinFilter, unsigned char textureMagFilter)
Definition: gls_font_renderer.h:144
Definition: bmpimage.h:46
GlsFontRenderer(const GlsFontBase *font)
Definition: gls_font_renderer.h:470
void RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Definition: gls_color.h:168
Definition: gls_font_base.h:85