View Full Version : glutIdleFunc
I was going over some example source code when I came across the glutIdleFunc which was set up as follows:
What does this do?
10-14-2000, 10:25 PM
I've used auxIdleFunc..... I assume that these do the same thing... Pretty much whenever the display loop isn't rendering this is the part that gets called...
Its usefull placing things in here such as animations(rotations, translations, ect.) because this will be called and then the scene will be rendered, displaying the changes... for an example of this look.... http://www.itknowledge.com/reference/archive/1571690735/ch03/049-052.html
The animation with aux is at the bottom of the page and code on the next... your glut code should look really similar(basically changing all of the aux's to glut's except in a few simple cases).
Edit: oh yeah, just in case you don't know.. the functions name goes into the ()'s after the name... just like how you specify the display function.
[This message has been edited by Mitchell Hayenga (edited 10-15-2000).]
Actually, I was wondering about what was going on inside the brackets of this example:
I assume it has the opposite effect of setting the callback function?
The stuff inside is just a mechanism in C for declaring a function pointer. In this case, you need to pass the name of a function that takes no arguments and returns none.
Hmm, I don't think this is a prototype, but rather something you put in your code, like any other call to GLUT to setup a callback function.
Is this correct, that you found this among other calls to GLUT in a compilable program?
First void says it's a return type of void, i.e return nothing.
Second part is just a type conversion of the interer value zero to a void pointer. In other words, a NULL pointer. This would be the same as glutIdleFunc(NULL);
10-15-2000, 07:55 AM
like cire said... http://reality.sgi.com/opengl/spec3/node63.html#SECTION000818000000000000000
I've used this function quite a bit and I've never really asked the question, "What specifically happens in here?" But my understanding of it is this; When you call the glutIdleFunc(somefunction);, what happens is it will continuously call the function specified while the processor is not doing anything else. ie.instead of waiting for a command input/keyboard key press/mouse button press or movement, this function call tells the processor to keep on calling the specified function over and over again. I like to think of it as a continuous loop. Now I'm no expert in this area as I too am new to OpenGL so you may wish to read a few of the others' responses before mine because I could be entirely in left field! http://www.opengl.org/discussion_boards/ubb/smile.gif If I am wrong/confused/mislead/misleading then please forgive me!
Ok, I get it. It just sets the callback function glutIdleFunc to NULL.
Don't want to be rude here, but I think you guys forgot the zero in the code Andy first posted. The thing inside the main paratheses is a typeconverted zero. From an integer to a void pointer with value zero and no return value and no arguments. Like Andy said, it sets the GLUT idle callback to NULL.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.