PDA

View Full Version : Text color problem



Vlasko
06-24-2003, 10:51 AM
i'm puting a bitmap text into my project and I'm unable to correctly change the color of it
code:
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glOrtho(-1.0f,1.0f,-1.0f,1.0f,1.0f,-1.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f(1.0f,1.0f,1.0f);
glRasterPos3f(-0.8f,0.8f,0.0f);
while(*p!='\0') glutBitmapCharacter(GLUT_BITMAP_HELVETICA_18,*p++) ;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glEnable(GL_DEPTH_TEST);
gluPerspective(60,ratio,0,200);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glColor3f doesn=t work correctly -i've got only dark green and black color

dorbie
06-25-2003, 02:21 AM
Make sure your rasterpos is called after your color in your actual code.

Vlasko
06-25-2003, 12:34 PM
rasterpos is called after glcolor as you can see in code(just copy and paste) and it's working but only those 2 colors

zeckensack
06-25-2003, 12:47 PM
But dorbie is right http://www.opengl.org/discussion_boards/ubb/wink.gif

The raster position attributes, just like vertex attributes (color, fog coord, tex coords) 'latch' into place when the glRasterPos call is issued. Calling glColor after glRasterPos has no effect (except, of course, for subsequent glRasterPos/glVertex calls).

Vlasko
06-26-2003, 06:45 AM
It's working now but i've got a problem with white color i think it should be 1,1,1 but i always get green-my last texture before i do bitmap operations is green could that be somehow connected to that?

zeckensack
06-26-2003, 08:14 AM
Pixel transfers (glDrawPixels/glBitmap) are affected by the complete fragment processing stuff, ie textures, fog, blending, alpha test. Texturing and fog probably have little utility in most cases, but that's how it is.

So you need to (temporarily) disable what you don't need.

Vlasko
06-26-2003, 11:53 AM
Thanks a lot with disabled texture_2d it's working fine