40 #ifndef _GLS_FONT_RENDERER_H
41 #define _GLS_FONT_RENDERER_H
70 typedef VertexNoColor
Vector;
88 typedef GlsFontBase::Char_t Char_t;
147 unsigned char textureMinFilter,
148 unsigned char textureMagFilter
192 glDisable( GL_TEXTURE_2D );
213 DISTI_DEPRECATED(
"This overload is deprecated because the clear text effect has been superseded. Use the DrawCharacter() overload without the 'inverse' parameter." )
215 const
bool emphasize,
216 const
float emphasisOffset,
222 const GLfloat y2 )
const
224 DrawCharacter( emphasize, emphasisOffset, quadStorage, x1, y1, x2, y2 );
237 const bool emphasize,
238 const float emphasisOffset,
239 GlsQuadListVCT_2D& quadStorage,
243 const GLfloat y2 )
const
246 quadStorage.AddQuad2D( x1, y1, x2, y2 );
252 GLfloat offsetY1( y1 + emphasisOffset );
253 GLfloat offsetY2( y2 + emphasisOffset );
255 quadStorage.AddQuad2D( x1 - emphasisOffset, offsetY1, x2 - emphasisOffset, offsetY2 );
256 quadStorage.AddQuad2D( x1 + emphasisOffset, offsetY1, x2 + emphasisOffset, offsetY2 );
274 const float haloOffset,
275 const float diagonalOffset,
276 GlsQuadListVCT_2D& quadStorage,
280 const GLfloat y2 )
const
282 const GLfloat x1right( x1 + diagonalOffset );
283 const GLfloat x1left( x1 - diagonalOffset );
284 const GLfloat x2right( x2 + diagonalOffset );
285 const GLfloat x2left( x2 - diagonalOffset );
286 const GLfloat y1up( y1 + diagonalOffset );
287 const GLfloat y1down( y1 - diagonalOffset );
288 const GLfloat y2up( y2 + diagonalOffset );
289 const GLfloat y2down( y2 - diagonalOffset );
291 quadStorage.AddQuad2D( x1left, y1up, x2left, y2up );
292 quadStorage.AddQuad2D( x1left, y1down, x2left, y2down );
293 quadStorage.AddQuad2D( x1right, y1up, x2right, y2up );
294 quadStorage.AddQuad2D( x1right, y1down, x2right, y2down );
295 quadStorage.AddQuad2D( x1 - haloOffset, y1, x2 - haloOffset, y2 );
296 quadStorage.AddQuad2D( x1, y1 - haloOffset, x2, y2 - haloOffset );
297 quadStorage.AddQuad2D( x1 + haloOffset, y1, x2 + haloOffset, y2 );
298 quadStorage.AddQuad2D( x1, y1 + haloOffset, x2, y2 + haloOffset );
321 DISTI_DEPRECATED(
"This overload is deprecated because the clear text effect has been superseded. Use the DrawCharacter() overload without the 'inverse' parameter." )
323 const
bool emphasize,
324 const
float emphasisOffset,
333 const GLfloat ty2 )
const
335 DrawCharacter( emphasize, emphasisOffset, x1, y1, x2, y2, tx1, ty1, tx2, ty2 );
356 const bool emphasize,
357 const float emphasisOffset,
365 const GLfloat ty2 )
const
369 MapTexture( x1, y1, x2, y2, tx1, ty1, tx2, ty2 );
374 GLfloat offsetY1( y1 + emphasisOffset );
375 GLfloat offsetY2( y2 + emphasisOffset );
378 x1 - emphasisOffset, offsetY1, x2 - emphasisOffset, offsetY2,
379 tx1, ty1, tx2, ty2 );
382 x1 + emphasisOffset, offsetY1, x2 + emphasisOffset, offsetY2,
383 tx1, ty1, tx2, ty2 );
405 const float haloOffset,
406 const float diagonalOffset,
414 const GLfloat ty2 )
const
417 GLfloat x1right( x1 + diagonalOffset );
418 GLfloat x1left( x1 - diagonalOffset );
419 GLfloat x2right( x2 + diagonalOffset );
420 GLfloat x2left( x2 - diagonalOffset );
421 GLfloat y1up( y1 + diagonalOffset );
422 GLfloat y1down( y1 - diagonalOffset );
423 GLfloat y2up( y2 + diagonalOffset );
424 GLfloat y2down( y2 - diagonalOffset );
430 x1left, y1up, x2left, y2up,
431 tx1, ty1, tx2, ty2 );
435 x1left, y1down, x2left, y2down,
436 tx1, ty1, tx2, ty2 );
440 x1right, y1up, x2right, y2up,
441 tx1, ty1, tx2, ty2 );
445 x1right, y1down, x2right, y2down,
446 tx1, ty1, tx2, ty2 );
450 x1 - haloOffset, y1, x2 - haloOffset, y2,
451 tx1, ty1, tx2, ty2 );
455 x1, y1 - haloOffset, x2, y2 - haloOffset,
456 tx1, ty1, tx2, ty2 );
460 x1 + haloOffset, y1, x2 + haloOffset, y2,
461 tx1, ty1, tx2, ty2 );
465 x1, y1 + haloOffset, x2, y2 + haloOffset,
466 tx1, ty1, tx2, ty2 );
484 const float shadowOffset,
492 const GLfloat ty2 )
const
503 tx1, ty1, tx2, ty2 );
531 glTexCoord2f( tx1, ty1 );
532 glVertex2f( x1, y1 );
533 glTexCoord2f( tx2, ty1 );
534 glVertex2f( x2, y1 );
535 glTexCoord2f( tx2, ty2 );
536 glVertex2f( x2, y2 );
537 glTexCoord2f( tx1, ty2 );
538 glVertex2f( x1, y2 );
586 stateManager->Texture2DEnabled(
true );
587 stateManager->BindTexture( texture );
592 stateManager->SetTextureMagFilter( GL_NEAREST );
596 stateManager->SetTextureMagFilter( GL_LINEAR );
600 switch( _textureMinFilter )
603 stateManager->SetTextureMinFilter( GL_NEAREST );
607 stateManager->SetTextureMinFilter( GL_LINEAR );
611 stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_NEAREST );
615 stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_LINEAR );
619 stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_LINEAR );
623 stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_NEAREST );
627 stateManager->SetTextureEnvMode( IGlsStateManager::GLS_TEXTURE_MAP_MODE_MODULATE );
643 glColor4ubv( _currentColor.
RGBA() );
646 glEnable( GL_TEXTURE_2D );
652 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
656 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
660 switch( _textureMinFilter )
663 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
666 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
669 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
672 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
675 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR );
678 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
682 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:564
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:436
Definition: IFontImage.h:53
void SetupTexture(IFontImage *texture)
Definition: gls_font_renderer.h:633
void TextureMinFilter(unsigned char val)
Definition: gls_font_renderer.h:102
The disti::GlsFontBase class and related classes.
The disti::GlsQuadListVC_3D and GlsQuadListVCT_2D classes.
GlsColor _currentColor
Definition: gls_font_renderer.h:557
Image * Texture() const
Definition: gls_font_base.h:317
virtual void BindTexture()=0
unsigned char TextureMagFilter()
Definition: gls_font_renderer.h:108
Definition: gls_state_manager_interface.h:67
Definition: gls_quad_storage.h:158
unsigned char TextureMinFilter()
Definition: gls_font_renderer.h:96
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:561
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
Definition: gls_font_renderer.h:355
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:404
Definition: gls_font_renderer.h:85
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:322
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:483
void SetFont(const GlsFontBase *font)
Definition: gls_font_renderer.h:128
Definition: gls_color.h:53
unsigned char _textureMagFilter
Definition: gls_font_renderer.h:567
void InitRendering()
Definition: gls_font_renderer.h:180
void TermRendering()
Definition: gls_font_renderer.h:190
Definition: display_types.h:71
void TextureMagFilter(unsigned char val)
Definition: gls_font_renderer.h:114
Definition: display_types.h:74
Definition: display_types.h:70
Definition: display_types.h:72
Character attributes. One item for each character in the set.
Definition: gls_font_base.h:124
Macros and helper code to determine what subset of C++11/14/17 is available.
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:521
void InitRendering(unsigned char textureMinFilter, unsigned char textureMagFilter)
Definition: gls_font_renderer.h:146
Definition: bmpimage.h:46
GlsFontRenderer(const GlsFontBase *font)
Definition: gls_font_renderer.h:547
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