PDA

View Full Version : Shadowed bitmap fonts?



Syslock
01-15-2003, 10:03 AM
How do you correctly render shadowed bitmap fonts? I create a display list of
fonts using wglUseFontBitmaps and render them like this in Ortho projection:

glDisable(GL_DEPTH_TEST);

INT x=10,y=20;

glColor3f( 0,0,0 );
glListBase( m_listbase );
glRasterPos2i( x+1, y+1 );
glCallLists( strlen("Test"), GL_UNSIGNED_BYTE, "Test" );

glColor3f( 1,1,1 );
glListBase( m_listbase );
glRasterPos2i( x, y );
glCallLists( strlen("Test"), GL_UNSIGNED_BYTE, "Test" );


But, from character to character, some pixels are offset wrong. It's not clean
and consistent. When I resize the client area area, you can see this clearly,
the shadowed pixels are jumping around and it looks really bad. Very ugly
shadowed text. What would cause this?

JustHanging
01-15-2003, 12:37 PM
Just a guess, but does shifting all your coordinates by 0.5 fix this? For some reason you have to do this with all the 2d stuff in opengl to get clean results.

-Ilkka

Syslock
01-15-2003, 02:39 PM
Just a guess, but does shifting all your coordinates by 0.5 fix this?


Sorry, but I don't completely understand what you mean.

Can you post in pseudo code what you mean by shifting?

My projection is setup like this:

glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho( 0.0, client_width, client_height, 0.0, -1.0, 1.0 );

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


[This message has been edited by Syslock (edited 01-15-2003).]

Syslock
01-15-2003, 02:53 PM
Thank You!

I added the line:
glTranslatef( 0.5f, 0.5f, 0.5f );

And it worked like magic!!

It's very solid.