Font colour problem
Ive just started OpenGL programming. Ive been developing a console system for a game I've just started making, and I've been working with font output to the screen. The problem I'm having is the text always outputs as very very very dark colours.
For instance glColor3f(1,0,0) gives a very dark maroon instead of red, glColor3f(0,1,0) gives a very dark green instead of lime, etc.
What am I doing wrong?
How are you rendering the text - bitmap fonts or font outlines? Is texturing enabled, is does your texture have RGB colors (if you have bitmap fonts)? Is your blending correct (if you're blending)? More code would help.
If texturing is enabled you might get effects like you describe. One way to ensure that the text gets the color you want is to
Example:
- Disable texturing before rendering the text
- Set the color for the text
- Draw text
- Reenable texturing
Example:
// Stores the color and texture state before the text renderingglPushAttrib(GL_CURRENT_BIT | GL_TEXTURE_BIT);glDisable(GL_TEXTURE_2D);glColor3f( 1.0f, 0.0f, 0.0f);// Render your text here// Restores the color and texture state back to what it was beforeglPopAttrib();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement