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)
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.