Skip to content

Instantly share code, notes, and snippets.

@EddyLuten
Created April 21, 2014 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EddyLuten/11132892 to your computer and use it in GitHub Desktop.
Save EddyLuten/11132892 to your computer and use it in GitHub Desktop.
Chapter 1, Snippet 7 - OpenGLBook.com
void IdleFunction(void)
{
glutPostRedisplay();
}
void TimerFunction(int Value)
{
if (0 != Value) {
char* TempString = (char*)
malloc(512 + strlen(WINDOW_TITLE_PREFIX));
sprintf(
TempString,
"%s: %d Frames Per Second @ %d x %d",
WINDOW_TITLE_PREFIX,
FrameCount * 4,
CurrentWidth,
CurrentHeight
);
glutSetWindowTitle(TempString);
free(TempString);
}
FrameCount = 0;
glutTimerFunc(250, TimerFunction, 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment