#21 glutGet***Func()

Billy B

One thing that makes it difficult to layer higher level
functionality on top of GLUT is that there is no way to
ask GLUT what the callbacks are set to. For instance,
users of the GLUI library are required to call some
kind of wacky API like GLUI_Master.set_glutIdleFunc()
instead of just glutIdleFunc. This is just because
GLUI needs to do idle processing too, so it registers
itself as the glutIdleFunc, and then calls your idle
func. But what if someone wants to use GLUI and some
other program that similarly needed to get idle
callbacks? Hmm.

Well all this would be easy if GLUT would just provide
an API to let libraries like GLUI hook into the idle func.

Hooking is a time honored tradition in C-based
messaging apis, and it's very handy to be able to do.
All that is needed is getter APIs like
glutGetIdleFunc() to go with the setters.


  • Joesph Krahn
    Joesph Krahn

    Logged In: YES

    It sound like what you want is multiple Idle functions, not
    hooks for the glutIdleFunc() callback. You don't really need
    to find out what some the other callbacks are, but just to be
    able to share resource, right?

    Look at FLTK for ideas:

    It supports multiple idle functions, and useful stuff like
    file descriptor callbacks, and event handlers to support
    unknown message (X11/Window) events.