Results 1 to 2 of 2

Thread: can glutSpecialkeys() interrupt other functions??

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2003
    Orlando, FL US

    can glutSpecialkeys() interrupt other functions??

    Say you have the following setup:

    void specialKeys()
    //pressing a key updates paramters for an object in the scene

    void display()
    //update object positions and draw the scene

    void main()
    //set up window etc...


    I'm doing a gravity/space physics simulation and the above setup works ok. The "player" can control a ship, when a key is pressed it alters the velocity of the chosen ship. But....

    When I really hammer the keys a lot some stuff starts going weird. My question is...when exactly does the "specialKeys" function update objects?? Can it interrupt the display function? If so, it can screw up partially calculated velocity vectors etc...

    Anybody know any specifics on this? Or a better way to handle user input in general? I'm using glut and c++.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Fargo, ND

    Re: can glutSpecialkeys() interrupt other functions??

    For Windows, things like keystrokes, window resizing, etc. are all placed on a message queue. (Look in MSDN at the WM_* messages for details on all the possible messages)

    Every Windows program then has a "message pump" that grabs those messages and calls a callback function generally called a "message handler" or WindowProc. For the typical single threaded app, the WindowProc function will finish handling the message it recieved before the message pump can grab another. (In a single threaded app, the message pump calls the WindowProc function and won't return from it until it's done its thing.)

    Glut does this same thing, but hides the details of it from you, so to give you a short answer to your question, No. glutSpecialFunc will NOT interrupt your diplay function unless you are doing something like bypassing the display callback and running the display function in another thread, which brings up a whole other set if issues...

    [This message has been edited by Deiussum (edited 06-24-2003).]
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Replies: 9
    Last Post: 10-18-2014, 02:00 PM
  2. Built-in Functions: Work-Item Functions
    By sean.settle in forum OpenCL
    Replies: 7
    Last Post: 11-17-2011, 07:39 AM
  3. PC interrupt using glClear
    By GT5 in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 05-16-2003, 07:02 AM
  4. Vertical retrace interrupt?
    By frink in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 03-17-2003, 05:22 AM
  5. how to add key functions
    By in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 02-26-2002, 09:15 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