Regain control after glutMainLoop() ?

Hi,
Thanks to the people who helped me before.
I have one more question on console IO with OpenGL. I set up my program to read some data from the console (Dos window) and draw the picture based on this data.

How do I regain control of my program after I call glutMainLoop? (So I can get more input from the user? Can I display my picture without using this “infinite?” loop.

I want to go back and forth from the picture to the console (take input, draw/ take input/draw…and so on)

Can someone help me? Thanks again.

Ace_Man
Bh9158@wcuvax1.wcu.edu

Hello

Sorry to say it, but you can’t exit the mainloop to obtain more data.

One idea with GLUT is to get away from all platforspecific code for windows/input, and make a common API for all platforms.

However, you can make your own input routine with glutKeyboardFunc().

Bob

There is a function that you could use, but it is surely not what you expected. It is the onexit() function (or maybe _onexit() or _atexit() ). When you escape the program (and so you escape the glutMainLoop() ) with exit(), this function is called so you can put some code before the program exits. The definition is _onexit(function) where function is the function that will be called before exiting.
This is not a good way, but it’s the only i know now.

Antoche