40 #ifndef _GLS_FONT_RENDERER_H
41 #define _GLS_FONT_RENDERER_H
69 typedef VertexNoColor
Vector;
87 typedef GlsFontBase::Char_t Char_t;
146 unsigned char textureMinFilter,
147 unsigned char textureMagFilter
191 glDisable( GL_TEXTURE_2D );
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 const float diagonalOffset,
253 GlsQuadListVCT_2D& quadStorage,
257 const GLfloat y2 )
const
259 const GLfloat x1right( x1 + diagonalOffset );
260 const GLfloat x1left( x1 - diagonalOffset );
261 const GLfloat x2right( x2 + diagonalOffset );
262 const GLfloat x2left( x2 - diagonalOffset );
263 const GLfloat y1up( y1 + diagonalOffset );
264 const GLfloat y1down( y1 - diagonalOffset );
265 const GLfloat y2up( y2 + diagonalOffset );
266 const GLfloat y2down( y2 - diagonalOffset );
268 quadStorage.AddQuad2D( x1left, y1up, x2left, y2up );
269 quadStorage.AddQuad2D( x1left, y1down, x2left, y2down );
270 quadStorage.AddQuad2D( x1right, y1up, x2right, y2up );
271 quadStorage.AddQuad2D( x1right, y1down, x2right, y2down );
272 quadStorage.AddQuad2D( x1 - haloOffset, y1, x2 - haloOffset, y2 );
273 quadStorage.AddQuad2D( x1, y1 - haloOffset, x2, y2 - haloOffset );
274 quadStorage.AddQuad2D( x1 + haloOffset, y1, x2 + haloOffset, y2 );
275 quadStorage.AddQuad2D( x1, y1 + haloOffset, x2, y2 + haloOffset );
301 const bool emphasize,
302 const float emphasisOffset,
311 const GLfloat ty2 )
const
317 stateManager->
AlphaBlendFuncSeparate( GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE );
322 MapTexture( x1, y1, x2, y2, tx1, ty1, tx2, ty2 );
325 if( emphasize && !inverse )
327 GLfloat offsetY1( y1 + emphasisOffset );
328 GLfloat offsetY2( y2 + emphasisOffset );
331 x1 - emphasisOffset, offsetY1, x2 - emphasisOffset, offsetY2,
332 tx1, ty1, tx2, ty2 );
335 x1 + emphasisOffset, offsetY1, x2 + emphasisOffset, offsetY2,
336 tx1, ty1, tx2, ty2 );
363 const float haloOffset,
364 const float diagonalOffset,
372 const GLfloat ty2 )
const
375 GLfloat x1right( x1 + diagonalOffset );
376 GLfloat x1left( x1 - diagonalOffset );
377 GLfloat x2right( x2 + diagonalOffset );
378 GLfloat x2left( x2 - diagonalOffset );
379 GLfloat y1up( y1 + diagonalOffset );
380 GLfloat y1down( y1 - diagonalOffset );
381 GLfloat y2up( y2 + diagonalOffset );
382 GLfloat y2down( y2 - diagonalOffset );
388 x1left, y1up, x2left, y2up,
389 tx1, ty1, tx2, ty2 );
393 x1left, y1down, x2left, y2down,
394 tx1, ty1, tx2, ty2 );
398 x1right, y1up, x2right, y2up,
399 tx1, ty1, tx2, ty2 );
403 x1right, y1down, x2right, y2down,
404 tx1, ty1, tx2, ty2 );
408 x1 - haloOffset, y1, x2 - haloOffset, y2,
409 tx1, ty1, tx2, ty2 );
413 x1, y1 - haloOffset, x2, y2 - haloOffset,
414 tx1, ty1, tx2, ty2 );
418 x1 + haloOffset, y1, x2 + haloOffset, y2,
419 tx1, ty1, tx2, ty2 );
423 x1, y1 + haloOffset, x2, y2 + haloOffset,
424 tx1, ty1, tx2, ty2 );
442 const float shadowOffset,
450 const GLfloat ty2 )
const
461 tx1, ty1, tx2, ty2 );
489 glTexCoord2f( tx1, ty1 );
490 glVertex2f( x1, y1 );
491 glTexCoord2f( tx2, ty1 );
492 glVertex2f( x2, y1 );
493 glTexCoord2f( tx2, ty2 );
494 glVertex2f( x2, y2 );
495 glTexCoord2f( tx1, ty2 );
496 glVertex2f( x1, y2 );
544 stateManager->Texture2DEnabled(
true );
545 stateManager->BindTexture( texture );
550 stateManager->SetTextureMagFilter( GL_NEAREST );
554 stateManager->SetTextureMagFilter( GL_LINEAR );
558 switch( _textureMinFilter )
561 stateManager->SetTextureMinFilter( GL_NEAREST );
565 stateManager->SetTextureMinFilter( GL_LINEAR );
569 stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_NEAREST );
573 stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_LINEAR );
577 stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_LINEAR );
581 stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_NEAREST );
585 stateManager->SetTextureEnvMode( IGlsStateManager::GLS_TEXTURE_MAP_MODE_MODULATE );
601 glColor4ubv( _currentColor.
RGBA() );
604 glEnable( GL_TEXTURE_2D );
610 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
614 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
618 switch( _textureMinFilter )
621 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
624 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
627 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
630 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
633 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR );
636 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
640 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
Definition: display_types.h:75
Definition: display_types.h:73
static IGlsStateManager * Instance(void)
virtual void MipMap(bool mipMap)=0
unsigned char _textureMinFilter
Definition: gls_font_renderer.h:522
virtual void AlphaBlendFuncSeparate(GLenum srcColor, GLenum dstColor, GLenum srcAlpha, GLenum dstAlpha)=0
Definition: IFontImage.h:53
void SetupTexture(IFontImage *texture)
Definition: gls_font_renderer.h:591
void TextureMinFilter(unsigned char val)
Definition: gls_font_renderer.h:101
virtual void PopAlphaBlendFunc()=0
The disti::GlsFontBase class and related classes.
The disti::GlsQuadListVC_3D and GlsQuadListVCT_2D classes.
GlsColor _currentColor
Definition: gls_font_renderer.h:515
Image * Texture() const
Definition: gls_font_base.h:317
virtual void BindTexture()=0
unsigned char TextureMagFilter()
Definition: gls_font_renderer.h:107
Definition: gls_state_manager_interface.h:67
Definition: gls_quad_storage.h:156
unsigned char TextureMinFilter()
Definition: gls_font_renderer.h:95
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.
virtual void PushAlphaBlendFunc()=0
const GlsFontBase * _font
Definition: gls_font_renderer.h:519
VertexNoColor Vector
Definition: gls_font_base.h:66
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
Definition: gls_font_renderer.h:362
Definition: gls_font_renderer.h:84
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:300
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:441
void SetFont(const GlsFontBase *font)
Definition: gls_font_renderer.h:127
Definition: gls_color.h:53
unsigned char _textureMagFilter
Definition: gls_font_renderer.h:525
void InitRendering()
Definition: gls_font_renderer.h:179
void TermRendering()
Definition: gls_font_renderer.h:189
Definition: display_types.h:71
void TextureMagFilter(unsigned char val)
Definition: gls_font_renderer.h:113
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:479
void InitRendering(unsigned char textureMinFilter, unsigned char textureMagFilter)
Definition: gls_font_renderer.h:145
Definition: bmpimage.h:46
GlsFontRenderer(const GlsFontBase *font)
Definition: gls_font_renderer.h:505
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