#include <GLViewer_Drawer.h>
Public Member Functions | |
GLViewer_TexFont () | |
A default constructor. More... | |
GLViewer_TexFont (QFont *theFont, int theSeparator=2, bool theIsResizeable=false, GLuint theMinMagFilter=GL_LINEAR) | |
A constructor. More... | |
~GLViewer_TexFont () | |
A destructor. More... | |
bool | generateTexture () |
Generating font texture. More... | |
void | drawString (QString theStr, GLdouble theX=0.0, GLdouble theY=0.0, GLfloat theScale=1.0) |
Drawing string theStr in point with coords theX and theY. More... | |
int | getSeparator () |
Returns separator between letters. More... | |
void | setSeparator (int theSeparator) |
Installing separator between letters. More... | |
int | getStringWidth (QString theString) |
Returns width of string in pixels. More... | |
int | getStringHeight () |
Returns height of string in pixels. More... | |
Static Public Member Functions | |
static void | clearTextBases () |
Clears all generated fonts. More... | |
Static Public Attributes | |
static QMap < GLViewer_TexFindId, GLViewer_TexIdStored > | TexFontBase |
Map for strorage generated texture fonts. More... | |
static QMap < GLViewer_TexFindId, GLuint > | BitmapFontCache |
Map for strorage generated bitmaps fonts. More... | |
Private Member Functions | |
void | init () |
Initializes font parameters. More... | |
Private Attributes | |
int | myNbSymbols |
Number of characters in the font texture. More... | |
int * | myWidths |
Array of letter width. More... | |
int * | myPositions |
Array of letter positions in texture. More... | |
QFont | myQFont |
Pointer to base font. More... | |
GLuint | myTexFont |
Font texture ID. More... | |
int | myTexFontWidth |
Font texture width. More... | |
int | myTexFontHeight |
Font texture height. More... | |
int | mySeparator |
Separator between letters. More... | |
bool | myIsResizeable |
Flag controlling scalability of this texmapped font. More... | |
GLuint | myMinMagFilter |
Min/mag filter. More... | |
int | myFontHeight |
Font height. More... | |
int | myMaxRowWidth |
Diagnostic information. More... | |
Font for GLViewer_Drawer, Drawing bitmap and texture fonts in GLViewer
GLViewer_TexFont::GLViewer_TexFont | ( | ) |
Default constructor
References init(), myIsResizeable, myMinMagFilter, myQFont, and mySeparator.
GLViewer_TexFont::GLViewer_TexFont | ( | QFont * | theFont, |
int | theSeparator = 2 , |
||
bool | theIsResizeable = false , |
||
GLuint | theMinMagFilter = GL_LINEAR |
||
) |
Constructor
theFont | - a base font |
theSeparator | - separator between letters |
theIsResizeable | - specifies whether text drawn by this object can be scaled along with the scene |
theMinMagFilter | - min/mag filter, affects text sharpness |
References init(), myIsResizeable, myMinMagFilter, myQFont, and mySeparator.
GLViewer_TexFont::~GLViewer_TexFont | ( | ) |
Destructor
References myPositions, and myWidths.
|
static |
Clears all generated fonts
References BitmapFontCache, and TexFontBase.
void GLViewer_TexFont::drawString | ( | QString | theStr, |
GLdouble | theX = 0.0 , |
||
GLdouble | theY = 0.0 , |
||
GLfloat | theScale = 1.0 |
||
) |
Drawing string in viewer
theStr | - string to be drawn |
theX | - X position |
theY | - Y position |
theScale | - scale coefficient |
References FirstSymbolNumber, modelMatrix, myFontHeight, myIsResizeable, myPositions, mySeparator, myTexFont, myTexFontHeight, myTexFontWidth, myWidths, TEX_ROW_GAP, and TEX_ROW_LEN.
bool GLViewer_TexFont::generateTexture | ( | ) |
Generating font texture
References aTexture, FirstSymbolNumber, GLViewer_TexFindId::myFontFamily, myFontHeight, GLViewer_TexFindId::myIsBold, GLViewer_TexFindId::myIsItal, GLViewer_TexFindId::myIsUndl, myMaxRowWidth, myMinMagFilter, myNbSymbols, GLViewer_TexFindId::myPointSize, myPositions, myQFont, myTexFont, GLViewer_TexIdStored::myTexFontHeight, myTexFontHeight, GLViewer_TexIdStored::myTexFontId, GLViewer_TexIdStored::myTexFontWidth, myTexFontWidth, GLViewer_TexFindId::myViewPortId, NB_TEX_COMP, TEX_ROW_GAP, TEX_ROW_LEN, and TexFontBase.
|
inline |
int GLViewer_TexFont::getStringHeight | ( | ) |
References myQFont.
int GLViewer_TexFont::getStringWidth | ( | QString | theStr | ) |
References FirstSymbolNumber, mySeparator, and myWidths.
|
private |
Initializes font parameters
References FirstSymbolNumber, LastSymbolNumber, myFontHeight, myMaxRowWidth, myNbSymbols, myPositions, myQFont, myTexFontHeight, myTexFontWidth, myWidths, and TEX_ROW_LEN.
|
inline |
|
static |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
static |