Shadowed bitmap fonts?

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:


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?

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.


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:

glOrtho( 0.0, client_width, client_height, 0.0, -1.0, 1.0 );


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

Thank You!

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

And it worked like magic!!

It’s very solid.