Sign in to follow this  

glut - fps counter

This topic is 4744 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

This topic is 4744 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this