View Full Version : String output questions

02-02-2004, 02:38 AM
I am using the following code to draw text to the screen:

outputString ( float x, float y, char *string )
int length;
length = strlen ( string );
glRasterPos2f ( x, y );
for (int i = 0; i < length; i++ )
glutBitmapCharacter (GLUT_BITMAP_HELVETICA_18 , string[i] );

And then in my code, changing the viewmode to 2d and calling the function:

outputString(0, 0, "TEXT OUTPUT TEST");

I have two questions if anyone can help me?

1: How do I change the color of the text on the screen, with light off, it is brown and when lighting is enabled, it is a browny color (yuk). I have tried glClearColor and glColor3f but to no avail.

2. When I change the two co-ordinates passed in, even though I beleive it to be the x,y co-ords of the text on the screen, it is always on the x=0 plane. Hmmmn.

02-02-2004, 02:40 AM
Sorry, I meant the x=0 plane http://www.opengl.org/discussion_boards/ubb/redface.gif) The up/down center.

02-02-2004, 05:16 AM
When you draw your text and disable GL_COLOR_MATERIAL and GL_LIGHTING.

Then set your text color with glColorf.

Not sure what you mean about X plan problem??

[This message has been edited by nexusone (edited 02-02-2004).]