tags:

views:

83

answers:

1

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?

A: 

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.

Ben Voigt
I see, problably it's better to go away from GLUT then. I'll try SDL.
angaran