I am trying to display some lines in the foreground in an OpenGL / GLUT application on MacOSX 10.7.2.
I am currently using this code to draw some lines in the foreground, and it works great.
void drawForeground() { int width = 10; int height = 10; glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrtho(-1, width, -1, height, -1, 1); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glDepthMask(GL_FALSE); glBegin(GL_LINES);
Now I would also like to draw some text. In the previous function, I added this piece of code to the line where I put asterisks:
glRasterPos2d(2,2); glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, 'c');
but it didn’t work. If I use the same two lines outside the drawForeground method, "c" will appear.
I already called glDisable(GL_TEXTURE_2D) and nothing has changed.
Can someone help me understand my mistake?
Decision:
It turned out that the solution turns off lighting using glDisable(GL_LIGHTING) , reinstalling it after rendering the text.
I would like to emphasize that the text is always displayed in one dimension regardless of the parameters of the glOrtho call.
source share