Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Regain control after glutMainLoop() ?

  1. #1
    Intern Contributor
    Join Date
    Mar 2000
    Posts
    94

    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

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    3,115

    Re: Regain control after glutMainLoop() ?

    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

  3. #3
    Intern Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    54

    Re: Regain control after glutMainLoop() ?

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •