sangaran
sangaran

Reputation: 317

How can I start a new glutMainLoop() after exiting one in OpenGL with Perl?

I've written a Perl script using OpenGL. It calls glutMainLoop() to let the user view some stuff, then the user closes the window but I want to let him continue using the script and reopening a new window and seeing some other stuff. Is that possible? I've found that it is possible to execute this instruction:

glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE,GLUT_ACTION_GLUTMAINLOOP_RETURNS);

to return to the code after the window is closed. But then if I call again a glut* function it tells me that I can't call it without calling glutInit and if I call glutInit it tells me that I can't just call it again! Is there some trick?

Upvotes: 1

Views: 920

Answers (1)

Ben Voigt
Ben Voigt

Reputation: 283694

You don't. OpenGL says: "This routine should be called at most once in a GLUT program."

Sounds like you need to use OpenGL without GLUT, or at least without glutMainLoop. Or maybe you can use an idle callback or timer callback to continue your windowless processing from inside the main loop.

Upvotes: 1

Related Questions