Skip to content

Commit afdae81

Browse files
authored
Update ofGLProgrammableRenderer.cpp
fix for not bound texture for font
1 parent d0077ba commit afdae81

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,17 +1892,16 @@ void ofGLProgrammableRenderer::drawString(string textString, float x, float y, f
18921892

18931893
//----------------------------------------------------------
18941894
void ofGLProgrammableRenderer::drawString(const ofTrueTypeFont & font, string text, float x, float y) const{
1895-
const_cast<ofGLProgrammableRenderer*>(this)->setAttributes(true,true,true,false);
1895+
ofGLProgrammableRenderer * mutThis = const_cast<ofGLProgrammableRenderer*>(this);
1896+
mutThis->setAttributes(true,true,true,false);
18961897
const ofTexture& tex = font.getFontTexture();
18971898
ofBlendMode blendMode = currentStyle.blendingMode;
18981899
if(tex.isAllocated()) {
1899-
const_cast<ofGLProgrammableRenderer*>(this)->setBlendMode(OF_BLENDMODE_ALPHA);
1900-
const_cast<ofGLProgrammableRenderer*>(this)->bind(tex,0);
1901-
//draw(font.getStringMesh(text,x,y,isVFlipped()),OF_MESH_FILL);
1902-
font.getStringMesh(text, x,y).draw();
1903-
//draw(font.getStringMesh(text,x,y),OF_MESH_FILL);
1904-
const_cast<ofGLProgrammableRenderer*>(this)->unbind(tex,0);
1905-
const_cast<ofGLProgrammableRenderer*>(this)->setBlendMode(blendMode);
1900+
mutThis->setBlendMode(OF_BLENDMODE_ALPHA);
1901+
mutThis->bind(font.getFontTexture(),0);
1902+
draw(font.getStringMesh(text,x,y,isVFlipped()),OF_MESH_FILL);
1903+
mutThis->unbind(font.getFontTexture(),0);
1904+
mutThis->setBlendMode(blendMode);
19061905
} else {
19071906
ofLogWarning("ofGLProgrammableRenderer") << "draw(): texture is not allocated";
19081907
}

0 commit comments

Comments
 (0)