PDA

View Full Version : FTGL fails to render on NVIDIA cards



Lee_Wilson
03-01-2009, 07:48 PM
Hi,

I have just implemented FTGL's pixmap font into an opengl game engine. We were previously using wglUseFontOutlines with WGL_FONT_POLYGONS but could never get the text anti-aliased. My dev box has an ATI Radeon X800 GTO and I successfully got the pixmap fonts rendering perfectly. However when it was tested on other peoples dev boxes that had NVIDIA cards (NVIDIA GeForce 8600 GT and a GeForece 4 TI) the fonts would not render. After alot of experimenting I found that when I stopped all the other graphic textures being rendered the text was rendered fine. As i added one small graphic texture back in at a time less and less text was rendered until no text was displayed at all. I am no expert in opengl so I tried to stick to the render setup we used for wglUseFontOutlines and replaced the call lists etc.

My render code looks like this:


//
//Save old matrix mode
//
GLint oldmode;
glGetIntegerv(GL_MATRIX_MODE,&oldmode);

glColor3f(((float)r/255.0f), ((float)g/255.0f), ((float)b/255.0f));

//
//Set to projection mode, Save old projection matrix, and load up
//the identity matrix.
//
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();

//
//Translate the matrix to position the text at the desired location.
//
glTranslated(x, -y, 0);
glScaled(scaleX, scaleY, 1.0);
glRasterPos2f(x,y);

glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();

ftglFont->Render(text);

glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(oldmode);

The graphic textures are loaded from png files and stored on the video cards memory for quick showing. The latest test I did was to setup a button that simply showed a few graphic textures and then hid them. The result was that text would become visible when the graphics were hidden and then disappear when the graphics were shown again.

Does anyone know what differences in the ATI and NVIDIA cards might cause this behaviour? and better still have a way to overcome it!

_NK47
03-02-2009, 06:40 AM
u need to set up renderstates before doing text rendering which is apparently set if you see the text but gets reset if you render something else. i would not recommend using pixmaps because they are slow and better use textures but those on the other hand might get blurry in some situations. to see any difference try other FTGL classes f.e the mentioned texture font class because the vary in rendering commands (ortho projection recommended).