Version: 6.3.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes

GLViewer_TexFont Class Reference

#include <GLViewer_Drawer.h>

Public Member Functions

 GLViewer_TexFont ()
 A default constructor.
 GLViewer_TexFont (QFont *theFont, int theSeparator=2, bool theIsResizeable=false, GLuint theMinMagFilter=GL_LINEAR)
 A constructor.
 ~GLViewer_TexFont ()
 A destructor.
bool generateTexture ()
 Generating font texture.
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.
int getSeparator ()
 Returns separator between letters.
void setSeparator (int theSeparator)
 Installing separator between letters.
int getStringWidth (QString theString)
 Returns width of string in pixels.
int getStringHeight ()
 Returns height of string in pixels.

Static Public Member Functions

static void clearTextBases ()
 Clears all generated fonts.

Static Public Attributes

static QMap
< GLViewer_TexFindId,
GLViewer_TexIdStored
TexFontBase
 Map for strorage generated texture fonts.
static QMap
< GLViewer_TexFindId, GLuint > 
BitmapFontCache
 Map for strorage generated bitmaps fonts.

Private Member Functions

void init ()
 Initializes font parameters.

Private Attributes

int myNbSymbols
 Number of characters in the font texture.
int * myWidths
 Array of letter width.
int * myPositions
 Array of letter positions in texture.
QFont myQFont
 Pointer to base font.
GLuint myTexFont
 Font texture ID.
int myTexFontWidth
 Font texture width.
int myTexFontHeight
 Font texture height.
int mySeparator
 Separator between letters.
bool myIsResizeable
 Flag controlling scalability of this texmapped font.
GLuint myMinMagFilter
 Min/mag filter.
int myFontHeight
 Font height.
int myMaxRowWidth
 Diagnostic information.

Detailed Description

Font for GLViewer_Drawer, Drawing bitmap and texture fonts in GLViewer


Constructor & Destructor Documentation

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

Parameters:
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.


Member Function Documentation

bool GLViewer_TexFont::generateTexture ( )
void GLViewer_TexFont::drawString ( QString  theStr,
GLdouble  theX = 0.0,
GLdouble  theY = 0.0,
GLfloat  theScale = 1.0 
)

Drawing string in viewer

Parameters:
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.

int GLViewer_TexFont.getSeparator ( )
void GLViewer_TexFont.setSeparator ( int  theSeparator)
int GLViewer_TexFont::getStringWidth ( QString  theStr)
Returns:
width of string in pixels

References FirstSymbolNumber, mySeparator, and myWidths.

int GLViewer_TexFont::getStringHeight ( )
Returns:
height of string in pixels

References myQFont.

void GLViewer_TexFont::clearTextBases ( ) [static]

Clears all generated fonts

References BitmapFontCache, and TexFontBase.

void GLViewer_TexFont::init ( ) [private]

Field Documentation

int* GLViewer_TexFont.myWidths [private]
QFont GLViewer_TexFont.myQFont [private]
GLuint GLViewer_TexFont.myTexFont [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS