Results 1 to 3 of 3

Thread: Regain control after glutMainLoop() ?

  1. #1
    Member 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
    2,978

    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
    Member Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    55

    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

Similar Threads

  1. Opengl camera control GUI instead of mouse control
    By zhar22 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-17-2013, 09:35 AM
  2. glutMainLoop
    By Mukund in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-16-2010, 02:53 PM
  3. glutmainloop again!!!
    By G in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-25-2003, 12:03 PM
  4. glutmainloop()
    By hcrogma in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 04-23-2003, 05:55 AM
  5. help with glutMainLoop() ...
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-22-2003, 12:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean