glut - fps counter

Started by
2 comments, last by Enigma 19 years, 4 months ago
Hey im making a little test program usung glut. the problem is render is only called one it needed. is there a way i can make it always be called as soon as possible so i can make a little benchmark app? cheers
Advertisement
Set the idle function to request a redisplay. Unfortunately you can't just pass glutPostRedisplay to glutIdleFunc, but wrapping it is trivial:
void redisplay(){	glutPostRedisplay();}int main(){	// ...	glutIdleFunc(redisplay);	// ...}

In general, all your update code should be in the idle function, not the display function, i.e.:
void update(){	// update all objects	glutPostRedisplay();}void render(){	// just render objects}int main(){	// ...	glutIdleFunc(update);	glutDisplayFunc(render);	// ...}


Enigma
hrmm this causes bad flickering using VBO's and with vertex arrays doesnt even display any of my test triangle :-/

i thought there was some way to have some sort of game loop using glut?
Glut has a game mode, but this just provides high-performance full-screen rendering. Do you enable double buffering? Constant update with single buffering will usually cause bad flicker.

Enigma

This topic is closed to new replies.

Advertisement