I use texture fonts in FTGL to render fonts on several canvases as labels for an axis, etc. My first plot goes well. However, all subsequent canvases make my texture fonts just black squares. I also noticed that some numbers are not displayed on the canvas, which is actually displayed. Center Time should display 8.3956, but instead displays the following.

Font selection is as follows:
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); PushGLMatrices(); GrSetPixelProjection(); glTranslatef(pixelX, pixelY, 0.0); glRotatef(ang, 0.0, 0.0, 1.0); savedFont->Render(label); PopGLMatrices();
Where
void PushGLMatrices() { glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); } void PopGLMatrices() { glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
I tried several things, such as clearing bits of color and depth, and glEnable (GL_TEXTURE_2D); glDisable (GL_DEPTH_TEST); but that didn't seem to help. For some reason, if I add FTTextureFont :: FaceSize (int) to one of my routines that returns the width of the text, everything displays correctly (albeit slowly). From looking at the source code of FTGL, it doesn't seem that FaceSize () will manipulate openGL parameters other than calling glDeleteTexture (), so I'm a little confused why this works.
source share