GL Studio C++ Runtime API
gls_font_renderer.h
Go to the documentation of this file.
1 /*! \file
2  \brief The disti::GlsFontRenderer class and related classes.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2017 by The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 #ifndef _GLS_FONT_RENDERER_H
41 #define _GLS_FONT_RENDERER_H
42 
43 #include "gls_gl.h"
44 #include <string>
45 #include <vector>
46 #ifdef GLES
47 # include "gls_quad_storage.h"
48 # include "gls_state_manager.h"
49 #endif
50 #include "IFontImage.h"
51 #include "gls_color.h"
52 #include "gls_cpp_lang_support.h"
53 #include "gls_font_base.h"
54 #include "gls_state_manager.h"
55 #include "image.h"
56 #include "vertex.h"
57 
58 //===========================================================================
59 // BEGIN NAMESPACE
60 //===========================================================================
61 namespace disti
62 {
63 //---------------------------------------------------------------------------
64 // FORWARD REFERENCES
65 //---------------------------------------------------------------------------
66 class VertexNoColor;
67 class GlsColor;
68 class Image;
69 
70 typedef VertexNoColor Vector;
71 
72 //===========================================================================
73 /**
74 *
75 * The GlsFontRenderer object can be used to render characters from a GlsFontBase in
76 * Open GL at specific locations and with several different text effects.
77 * Prior to rendering any characters, InitRendering must be invoked to set
78 * up the proper drawing environment. Then call Render for each character
79 * to be drawn.
80 *
81 * \sa GlsFontBase
82 *
83 */
84 //===========================================================================
86 {
87 public:
88  typedef GlsFontBase::Char_t Char_t;
90 
91  //----------------------------------------
92  // Character rendering state variables
93  //----------------------------------------
94 
95  /** Returns the minification filter for this font */
96  unsigned char TextureMinFilter()
97  {
98  return _textureMinFilter;
99  }
100 
101  /** Sets the minification filter for this font */
102  void TextureMinFilter( unsigned char val )
103  {
104  _textureMinFilter = val;
105  }
106 
107  /** Returns the magnification filter for this font */
108  unsigned char TextureMagFilter()
109  {
110  return _textureMagFilter;
111  }
112 
113  /** Sets the magnification filter for this font */
114  void TextureMagFilter( unsigned char val )
115  {
116  _textureMagFilter = val;
117  }
118 
119  //----------------------------------------
120  // Setup and cleanup for rendering
121  //----------------------------------------
122 
123  /**
124  * Set the font to use.
125  * The font pointer must be set before calling
126  * any rendering methods
127  */
128  void SetFont( const GlsFontBase* font )
129  {
130  _font = font;
131  }
132  const GlsFontBase* GetFont( void )
133  {
134  return _font;
135  }
136 
137  /**
138  * Initializes the font to begin rendering characters. This will set up
139  * Open GL texture modes, bind the font's texture, set up minification
140  * and magnification filters, etc. This must be called once before
141  * invoking Render to draw characters. This version overwrites the
142  * texture minification and magnification filters before initializing.
143  * \param textureMinFilter Minification mode for the font texture
144  * \param textureMagFilter Magnification mode for the font texture
145  */
147  unsigned char textureMinFilter,
148  unsigned char textureMagFilter
149 #ifdef GLES
150  ,
151  IGlsStateManager* stateManager
152 #endif // GLES
153  )
154  {
155  _textureMinFilter = textureMinFilter;
156  _textureMagFilter = textureMagFilter;
158 #ifdef GLES
159  stateManager
160 #endif // GLES
161  );
162  }
163 
164  /**
165  * Initializes the font to begin rendering characters. This will set up
166  * Open GL texture modes, bind the font's texture, set up minification
167  * and magnification filters, etc. This must be called before
168  * using any of the Render methods draw characters.
169  */
170 
171 #ifdef GLES
172 
173  void InitRendering( IGlsStateManager* stateManager )
174  {
175  SetupTexture( _font->Texture(), stateManager );
176  }
177 
178 #else // !GLES
179 
181  {
182  SetupTexture( _font->Texture() );
183  }
184 
185  /**
186  * Restores the Open GL state as it was before the call to InitRendering.
187  * This should be called after all characters have been rendered using
188  * the Render methods.
189  */
191  {
192  glDisable( GL_TEXTURE_2D );
193  } // end GlsFontRenderer::TermRendering
194 
195 #endif // GLES
196 
197  //----------------------------------------
198  // Rendering Methods
199  //----------------------------------------
200 
201 #ifdef GLES
202  /** Draw a character by adding it into the supplied QuadStorage object
203  * \deprecated inverse no longer has any effect, use the other overload instead.
204  * \param emphasize Whether to draw with emphasize or not
205  * \param emphasisOffset If drawing with emphasize, the offset in logical units
206  * \param inverse Deprecated, has no effect
207  * \param quadStorage The quad storage object to render the characters into
208  * \param x1 lower left corner x coordinate of the polygon
209  * \param y1 lower left corner y coordinate of the polygon
210  * \param x2 upper right corner x coordinate of the polygon
211  * \param y2 upper right corner y coordinate of the polygon
212  */
213  DISTI_DEPRECATED( "This overload is deprecated because the clear text effect has been superseded. Use the DrawCharacter() overload without the 'inverse' parameter." )
214  void DrawCharacter(
215  const bool emphasize,
216  const float emphasisOffset,
217  const bool inverse,
218  GlsQuadListVCT_2D& quadStorage,
219  const GLfloat x1,
220  const GLfloat y1,
221  const GLfloat x2,
222  const GLfloat y2 ) const
223  {
224  DrawCharacter( emphasize, emphasisOffset, quadStorage, x1, y1, x2, y2 );
225  }
226 
227  /** Draw a character by adding it into the supplied QuadStorage object
228  * \param emphasize Whether to draw with emphasize or not
229  * \param emphasisOffset If drawing with emphasize, the offset in logical units
230  * \param quadStorage The quad storage object to render the characters into
231  * \param x1 lower left corner x coordinate of the polygon
232  * \param y1 lower left corner y coordinate of the polygon
233  * \param x2 upper right corner x coordinate of the polygon
234  * \param y2 upper right corner y coordinate of the polygon
235  */
236  void DrawCharacter(
237  const bool emphasize,
238  const float emphasisOffset,
239  GlsQuadListVCT_2D& quadStorage,
240  const GLfloat x1,
241  const GLfloat y1,
242  const GLfloat x2,
243  const GLfloat y2 ) const
244  {
245  // character color
246  quadStorage.AddQuad2D( x1, y1, x2, y2 );
247 
248  // Character emphasis. Draw two more cells offset a little so
249  // character appears bolded.
250  if( emphasize )
251  {
252  GLfloat offsetY1( y1 + emphasisOffset );
253  GLfloat offsetY2( y2 + emphasisOffset );
254 
255  quadStorage.AddQuad2D( x1 - emphasisOffset, offsetY1, x2 - emphasisOffset, offsetY2 );
256  quadStorage.AddQuad2D( x1 + emphasisOffset, offsetY1, x2 + emphasisOffset, offsetY2 );
257  }
258 
259  } // end GlsFontRenderer::DrawCharacter
260 
261  /**
262  * Draws a halo effect for the given character.
263  *
264  * \param c the character code to render
265  * \param haloOffset Controls the size of the halo
266  * GlsTextGrid uses: (emphasize ? 0.05f : 0.03f) * (character_width) (x2 - x1)
267  * \param _vertArray Pointer to the currently bound vertex array
268  * \param x1 lower left corner x coordinate of the polygon
269  * \param y1 lower left corner y coordinate of the polygon
270  * \param x2 upper right corner x coordinate of the polygon
271  * \param y2 upper right corner y coordinate of the polygon
272  */
273  void DrawHalo(
274  const float haloOffset,
275  const float diagonalOffset,
276  GlsQuadListVCT_2D& quadStorage,
277  const GLfloat x1,
278  const GLfloat y1,
279  const GLfloat x2,
280  const GLfloat y2 ) const
281  {
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 );
290 
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 );
299  }
300 
301 #else // !GLES
302  /**
303  * Draws a character.
304  * \deprecated inverse no longer has any effect, use the other overload instead.
305  *
306  * \param emphasize true if the rendered character should be emphasized.
307  * This will essentially bold the character. If a bold
308  * font is being used, the character will appear even
309  * more bolded.
310  * \param emphasisOffset Magnitude of the emhpasis offset. A good value to try is (0.2 * character_width).
311  * \param inverse Deprecated, has no effect
312  * \param x1 lower left corner x coordinate of the polygon
313  * \param y1 lower left corner y coordinate of the polygon
314  * \param x2 upper right corner x coordinate of the polygon
315  * \param y2 upper right corner y coordinate of the polygon
316  * \param tx1 lower left corner x texture coordinate
317  * \param ty1 lower left corner y texture coordinate
318  * \param tx2 upper right corner x texture coordinate
319  * \param ty2 upper right corner y texture coordinate
320  */
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,
325  const bool inverse,
326  const GLfloat x1,
327  const GLfloat y1,
328  const GLfloat x2,
329  const GLfloat y2,
330  const GLfloat tx1,
331  const GLfloat ty1,
332  const GLfloat tx2,
333  const GLfloat ty2 ) const
334  {
335  DrawCharacter( emphasize, emphasisOffset, x1, y1, x2, y2, tx1, ty1, tx2, ty2 );
336  }
337 
338  /**
339  * Draws a character.
340  *
341  * \param emphasize true if the rendered character should be emphasized.
342  * This will essentially bold the character. If a bold
343  * font is being used, the character will appear even
344  * more bolded.
345  * \param emphasisOffset Magnitude of the emhpasis offset. A good value to try is (0.2 * character_width).
346  * \param x1 lower left corner x coordinate of the polygon
347  * \param y1 lower left corner y coordinate of the polygon
348  * \param x2 upper right corner x coordinate of the polygon
349  * \param y2 upper right corner y coordinate of the polygon
350  * \param tx1 lower left corner x texture coordinate
351  * \param ty1 lower left corner y texture coordinate
352  * \param tx2 upper right corner x texture coordinate
353  * \param ty2 upper right corner y texture coordinate
354  */
356  const bool emphasize,
357  const float emphasisOffset,
358  const GLfloat x1,
359  const GLfloat y1,
360  const GLfloat x2,
361  const GLfloat y2,
362  const GLfloat tx1,
363  const GLfloat ty1,
364  const GLfloat tx2,
365  const GLfloat ty2 ) const
366  {
367  glBegin( GL_QUADS );
368 
369  MapTexture( x1, y1, x2, y2, tx1, ty1, tx2, ty2 );
370  // Character emphasis. Draw two more cells offset a little so
371  // character appears bolded.
372  if( emphasize )
373  {
374  GLfloat offsetY1( y1 + emphasisOffset );
375  GLfloat offsetY2( y2 + emphasisOffset );
376 
377  MapTexture(
378  x1 - emphasisOffset, offsetY1, x2 - emphasisOffset, offsetY2,
379  tx1, ty1, tx2, ty2 );
380 
381  MapTexture(
382  x1 + emphasisOffset, offsetY1, x2 + emphasisOffset, offsetY2,
383  tx1, ty1, tx2, ty2 );
384  }
385 
386  glEnd();
387 
388  } // end GlsFontRenderer::DrawCharacter
389 
390  /**
391  * Draws a halo effect for the given character.
392  *
393  * \param haloOffset Controls the size of the halo
394  * GlsTextGrid uses: (emphasize ? 0.05f : 0.03f) * (character_width) (x2 - x1)
395  * \param x1 lower left corner x coordinate of the polygon
396  * \param y1 lower left corner y coordinate of the polygon
397  * \param x2 upper right corner x coordinate of the polygon
398  * \param y2 upper right corner y coordinate of the polygon
399  * \param tx1 lower left corner x texture coordinate
400  * \param ty1 lower left corner y texture coordinate
401  * \param tx2 upper right corner x texture coordinate
402  * \param ty2 upper right corner y texture coordinate
403  */
404  void DrawHalo(
405  const float haloOffset,
406  const float diagonalOffset,
407  const GLfloat x1,
408  const GLfloat y1,
409  const GLfloat x2,
410  const GLfloat y2,
411  const GLfloat tx1,
412  const GLfloat ty1,
413  const GLfloat tx2,
414  const GLfloat ty2 ) const
415  {
416  // Halo effect.
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 );
425 
426  glBegin( GL_QUADS );
427 
428  // Shift left and up
429  MapTexture(
430  x1left, y1up, x2left, y2up,
431  tx1, ty1, tx2, ty2 );
432 
433  // Shift left and down
434  MapTexture(
435  x1left, y1down, x2left, y2down,
436  tx1, ty1, tx2, ty2 );
437 
438  // Shift right and up
439  MapTexture(
440  x1right, y1up, x2right, y2up,
441  tx1, ty1, tx2, ty2 );
442 
443  // Shift right and down
444  MapTexture(
445  x1right, y1down, x2right, y2down,
446  tx1, ty1, tx2, ty2 );
447 
448  // Shift left
449  MapTexture(
450  x1 - haloOffset, y1, x2 - haloOffset, y2,
451  tx1, ty1, tx2, ty2 );
452 
453  // Shift down
454  MapTexture(
455  x1, y1 - haloOffset, x2, y2 - haloOffset,
456  tx1, ty1, tx2, ty2 );
457 
458  // Shift right
459  MapTexture(
460  x1 + haloOffset, y1, x2 + haloOffset, y2,
461  tx1, ty1, tx2, ty2 );
462 
463  // Shift up
464  MapTexture(
465  x1, y1 + haloOffset, x2, y2 + haloOffset,
466  tx1, ty1, tx2, ty2 );
467 
468  glEnd();
469  } // end GlsFontRenderer::DrawHalo
470 
471  /**
472  * Draws a drop shadow effect for a character.
473  * \param shadowOffset distance to offset the shadow from the character
474  * \param x1 lower left corner x coordinate of the polygon
475  * \param y1 lower left corner y coordinate of the polygon
476  * \param x2 upper right corner x coordinate of the polygon
477  * \param y2 upper right corner y coordinate of the polygon
478  * \param tx1 lower left corner x texture coordinate
479  * \param ty1 lower left corner y texture coordinate
480  * \param tx2 upper right corner x texture coordinate
481  * \param ty2 upper right corner y texture coordinate
482  */
484  const float shadowOffset,
485  const GLfloat x1,
486  const GLfloat y1,
487  const GLfloat x2,
488  const GLfloat y2,
489  const GLfloat tx1,
490  const GLfloat ty1,
491  const GLfloat tx2,
492  const GLfloat ty2 ) const
493  {
494  // Shadow effect.
495  glBegin( GL_QUADS );
496 
497  // Shift right and down
498  MapTexture(
499  x1 + shadowOffset,
500  y1 - shadowOffset,
501  x2 + shadowOffset,
502  y2 - shadowOffset,
503  tx1, ty1, tx2, ty2 );
504 
505  glEnd();
506 
507  } // end GlsFontRenderer::DrawShadow
508 
509  /**
510  * Map a square piece of a texture onto a quad ( assumed to be called
511 between glBegin(GL_QUADS)...glEnd() pair )
512  * \param x1 the lower left corner x of the quad
513  * \param y1 the lower left corner y of the quad
514  * \param x2 the upper right corner x of the quad
515  * \param y2 the upper right corner of the quad
516  * \param tx1 lower left corner x texture coordinate
517  * \param ty1 lower left corner y texture coordinate
518  * \param tx2 upper right corner x texture coordinate
519  * \param ty2 upper right corner y texture coordinate
520  */
521  static void MapTexture(
522  const GLfloat x1,
523  const GLfloat y1,
524  const GLfloat x2,
525  const GLfloat y2,
526  const GLfloat tx1,
527  const GLfloat ty1,
528  const GLfloat tx2,
529  const GLfloat ty2 )
530  {
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 );
539  }
540 
541 #endif // GLES
542 
543  /**
544  * Create a GlsFontRenderer with the default settings.
545  * \param font The font to use for rendering. This may be NULL on creation, but it must be set before rendering.
546  */
548  : _font( font )
551  {
552  }
553 
554 protected:
555 #ifndef GLES
556  /** Current drawing color is kept so we don't have to make an OpenGL call if the color is the same */
558 #endif
559 
560  /** Pointer to the font to use for rendering */
562 
563  /** Minification mode for the font texture */
564  unsigned char _textureMinFilter;
565 
566  /** Magnification mode for the font texture */
567  unsigned char _textureMagFilter;
568 
569  /**
570  * Helper method to set up Open GL texture modes, bind the font's texture,
571  * set up minification and magnification filters, etc.
572  */
573 
574 #ifdef GLES
575 
576  void SetupTexture( IFontImage* texture, IGlsStateManager* stateManager )
577  {
579  if( mipMap )
580  {
581  // This will force the image to create the mipmap images
582  texture->MipMap( true );
583  }
584 
585  // Initialize the font texture
586  stateManager->Texture2DEnabled( true );
587  stateManager->BindTexture( texture );
588 
589  // Set up mip mapping for magnification
590  if( _textureMagFilter == TEXTURE_FILTER_NEAREST )
591  {
592  stateManager->SetTextureMagFilter( GL_NEAREST );
593  }
594  else if( _textureMagFilter == TEXTURE_FILTER_LINEAR )
595  {
596  stateManager->SetTextureMagFilter( GL_LINEAR );
597  }
598 
599  // Set up mip mapping for minification
600  switch( _textureMinFilter )
601  {
603  stateManager->SetTextureMinFilter( GL_NEAREST );
604  break;
605 
607  stateManager->SetTextureMinFilter( GL_LINEAR );
608  break;
609 
611  stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_NEAREST );
612  break;
613 
615  stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_LINEAR );
616  break;
617 
619  stateManager->SetTextureMinFilter( GL_NEAREST_MIPMAP_LINEAR );
620  break;
621 
623  stateManager->SetTextureMinFilter( GL_LINEAR_MIPMAP_NEAREST );
624  break;
625  }
626 
627  stateManager->SetTextureEnvMode( IGlsStateManager::GLS_TEXTURE_MAP_MODE_MODULATE );
628 
629  } // end GlsFontRenderer::SetupTexture
630 
631 #else // !GLES
632 
633  void SetupTexture( IFontImage* texture )
634  {
636  if( mipMap )
637  {
638  // This will force the image to create the mipmap images
639  texture->MipMap( true );
640  }
641 
642  // Initialize the drawing color
643  glColor4ubv( _currentColor.RGBA() );
644 
645  // Initialize the font texture
646  glEnable( GL_TEXTURE_2D );
647  texture->BindTexture();
648 
649  // Set up mip mapping for magnification
650  if( _textureMagFilter == TEXTURE_FILTER_NEAREST )
651  {
652  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
653  }
654  else if( _textureMagFilter == TEXTURE_FILTER_LINEAR )
655  {
656  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
657  }
658 
659  // Set up mip mapping for minification
660  switch( _textureMinFilter )
661  {
663  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
664  break;
666  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
667  break;
669  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
670  break;
672  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR );
673  break;
675  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR );
676  break;
678  glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );
679  break;
680  }
681 
682  glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
683 
684  } // end GlsFontRenderer::SetupTexture
685 
686 #endif // GLES
687 
688 }; // end class GlsFontRenderer
689 
690 } // end namespace disti
691 
692 #endif
Definition: display_types.h:69
Definition: display_types.h:67
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:65
void TextureMagFilter(unsigned char val)
Definition: gls_font_renderer.h:114
Definition: display_types.h:68
Definition: display_types.h:64
Definition: display_types.h:66
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
IFontImage.
Definition: gls_font_base.h:85
The gls_gl.