Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

AxoDosS

Member Since 18 Apr 2002
Offline Last Active Jul 29 2012 10:26 AM
-----

#3485374 Terminating a GLUT loop inside a program

Posted by AxoDosS on 18 February 2006 - 09:09 PM

Here is one way of doing it:

void myIdleFunc()
{
  ...
  if (should_we_exit)
  {
    throw "MY_EXIT_MESSAGE";
  }
}

int main()
{
  try
  {
    ...
    glutMainLoop();
  }
  catch (const char* msg)
  {
    ...
  }

  cleanup();
  printf("program terminated\n");

  return EXIT_SUCCESS;
}





PARTNERS