PDA

View Full Version : Outline Font and FOG problem



skyeyes
05-08-2008, 02:33 PM
Hi there,

I have a Opengl program that makes use of Outline Font. The problem is, whenever I enabled FOG, my application doesn't display my output text on screen. When I remove the 1 line - glEnable(GL_FOG);- my text seems to display ok.

I'm just curious, is there any special function calls I need to make in order to use FOG and Outline fonts together in the same application?


Thanks

Relic
05-08-2008, 03:35 PM
That could be multiple things,
- either something is really broken with your implementation and it really doesn't render correctly or
- your fog setup and rendering positions are not giving the desired effect. Enabling fog is not all there is to do nice fog. You need to set the fog mode, start and end, resp. density values. EXP and EXP2 fog mode density values need to be handled carefully. Tiny changes can have a big impact.
- Fog also only works right if you do not put any "camera" methods into the projection matrix. Camera stuff belongs into the modelview matrix or fog will be wrong.

Try if setting the clear color to something different than the fog color show some fonts rendered fully fogged.

If not, provide your matrix and fog setup code while rendering the font so that we can look at what you're doing.

skyeyes
05-08-2008, 03:57 PM
Hi there Relic,

I've now solved this problem. The problem came from my usage of glEnable/glDisable. Basically, once you enable something and have finished using it, you must disable it accordingly.

So, my resulting code ended up as below:

glPushMatrix();
glDisable(GL_FOG);
RenderFont(0.0f, 0.0f, 0.0f, m_fontListBase, "OpenGL Rocks!");
glEnable(GL_FOG);
glPopMatrix();


Thanks and regards