return -1;
}
-void OpenGl_FontMgr::render_text( const Standard_Integer id, const char* text)
+void OpenGl_FontMgr::render_text( const Standard_Integer id, const char* text,
+ const Standard_Boolean is2d )
{
#ifdef TRACE
cout << "TKOpenGl::render_text\n"
if( !enableTexture )
glEnable(GL_TEXTURE_2D);
- if( !enableDepthTest )
- glEnable(GL_DEPTH_TEST);
+ if ( !is2d ) {
+ if ( !enableDepthTest )
+ glEnable(GL_DEPTH_TEST);
+ }
+ else if ( enableDepthTest ) {
+ glDisable(GL_DEPTH_TEST);
+ }
GLint* param = new GLint;
glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, param);
}
-void OpenGl_FontMgr::render_text( const char* text){
- render_text( _CurrentFontId, text );
+void OpenGl_FontMgr::render_text( const char* text, const Standard_Boolean is2d ){
+ render_text( _CurrentFontId, text, is2d );
}
return 0.f;
OGLFont_Cache cache = _FontCache.Find( id );
- GLenum err = glGetError();
Standard_ShortReal w = cache.Font->Advance( str );
const Standard_Integer fontHeight );
void render_text( const Standard_Integer id,
- const char* text );
+ const char* text,
+ const Standard_Boolean is2d = 0 );
//render text by last requested font
- void render_text( const char* text );
+ void render_text( const char* text, const Standard_Boolean is2d = 0 );
//returns direct access to FTGL font
//Warning: don't change font pointer.
GLdouble xdis = 0., ydis = 0.;
GLint renderMode;
+ // FTFont changes texture state when it renders and computes size for the text
+ glPushAttrib(GL_TEXTURE_BIT);
StringSize(str, &widthFont, &ascentFont, &descentFont );
GLdouble identityMatrix[4][4] =
TsmGetAttri( 1, &keyZoom );
zoom = keyZoom.data.ldata;
+ CMN_KEY keyfontName;
+ keyfontName.id = TelTextFont;//This flag responding about TextFontName
+ TsmGetAttri( 1, &keyfontName );
+ char *fontName = new char[strlen((char*)keyfontName.data.pdata) + 1];
+ strcpy(fontName,(char*)keyfontName.data.pdata);
+
OpenGl_TextRender* textRender = OpenGl_TextRender::instance();
int vh = 2 ;
int vv = 2 ;
OpenGl_FontMgr* mgr = OpenGl_FontMgr::instance();
const FTFont* fnt = mgr->fontById( curFont );
- if ( !fnt )
+ if ( !fnt ) {
+ glPopAttrib();
return;
+ }
float export_h = 1.;
if ( renderMode == GL_FEEDBACK )
{
#ifdef HAVE_GL2PS
- CMN_KEY keyfontName;
- keyfontName.id = TelTextFont;//This flag responding about TextFontName
- TsmGetAttri( 1, &keyfontName );
- char *fontName = new char[strlen((char*)keyfontName.data.pdata) + 1];
- strcpy(fontName,(char*)keyfontName.data.pdata);
-
export_h = (GLdouble)fnt->FaceSize() / export_h;
int aligment = alignmentforgl2ps( vh, vv );
glPopMatrix();
ExportText( str, fontName, export_h, angle, aligment, x, y, z, is2d!=0 );
- delete [] fontName;
#endif
}
else
{
- mgr->render_text( curFont, str );
+ mgr->render_text( curFont, str, is2d );
glPopMatrix();
}
+ glPopAttrib();
+ delete [] fontName;
return;
}