PDA

View Full Version : Blinking and depth buffer



lsdi
01-08-2002, 12:20 PM
Im using this code to render fonts, but I got this problems:
- In windowed mode, theres no blinking but the text is drawn behind the poligons.
- In fullscreen, text its ok, but the screen start to blink.

Can you guys help me?
(sorry about bad english)

void mundo(void)
{
glPushMatrix();
PrintString("Hello",0.02,0.98);
glPopMatrix();
glPushMatrix();
gluLookAt(cam.x,cam.y,cam.z,
tx,ty,tz,
rx,ry,rz);

glCallList(Lsea);

glPushMatrix();
glCallList(Lterrain);
glPopMatrix();
glPopMatrix();
glFlush ();
}

void PrintString(char *s,float x,float y) {
glPushAttrib(GL_LIGHTING_BIT|GL_DEPTH_BUFFER_BIT|G L_TEXTURE_BIT);
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
glRasterPos2f(x,y);
writef(s);
glRasterPos2f(0,0);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopAttrib();
}

void writef(char *s)
{
glPushAttrib(GL_LIST_BIT);
glListBase(fontOffset);
glCallLists(strlen(s), GL_UNSIGNED_BYTE, (GLubyte *) s);
glPopAttrib ();
}


Thanks for help people.

As you can see I disabled depth buffer...

nemesis
01-09-2002, 12:28 AM
Hello Isdi!

Just guessing...
You are drawing while GL_PROJECTION matrix is enabled.
Just try to change GL_PROJECTION to GL_MODELVIEW and GL_MODELVIEW to GL_PROJECTION.

-nemesis-