Jump to content
  • Advertisement
Sign in to follow this  
supagu

glut - fps counter

This topic is 4995 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
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

Share this post


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

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!