Does anyone know, how I would go about displaying a counter in my window. I want to display a frame rate counter.
Thanks
Does anyone know, how I would go about displaying a counter in my window. I want to display a frame rate counter.
Thanks
Here is what I do:
// easy way to put text on the screen.
glMatrixMode (GL_PROJECTION);
glLoadIdentity();
glOrtho(-8.0, 8.0, 8.0, -8.0, -1.0, 30.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
// Put view state on screen
glColor3f( 1.0, 1.0, 1.0);
Sprint(-3, 4, “Text”);
Note: You can change to perspective mode after writing text…
my text routine:
void Sprint( int x, int y, char *st)
{
int l,i;
l=strlen( st );
glRasterPos2i( x, y);
for( i=0; i < l; i++)
{
// look up glutbitmapcharactor for the other fonts, built in.
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, st[i]);
}
}
Originally posted by Tweener:
[b]Does anyone know, how I would go about displaying a counter in my window. I want to display a frame rate counter.
Thanks [/b]
Thank you very much, this is so much simpler than the way I was doing it.