1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| void drawTexte(void *font, const char *string, float x, float y)
{
glPushAttrib( GL_LIGHTING | GL_DEPTH_TEST | GL_LIST_BIT );
glDisable(GL_TEXTURE_2D);
glDisable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST) ;
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluOrtho2D(0,800,0,600); // ma fenetre est en 800x600
//glOrtho(-18,18,-10,10,-100,100);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glColor3i(1,1,0);
glRasterPos2f(x,y); // j'ai aussi essayé en forcant la position a (100,100) ou a une position 3d visible dans la scene
//glWindowPos2f(x,y); // ma version d'opengl ne supporte pas ca apparement, mais ca m'aurait vraiment arrangé...
p = (char*) string;
while (*p != '\0') glutBitmapCharacter(font, *p++);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopAttrib();
} |
Partager