glutIdleFunc()

用法: void c(void

用法:
void glutIdleFunc(void (*func)(void));
說明:
glutIdleFunc sets the global idle callback to be func so a GLUT program can perform background processing tasks or continuous animation when window system events are not being received. If enabled, the idle callback is continuously called when events are not being received. The callback routine has no parameters. The current window and current menu will not be changed before the idle callback. Programs with multiple windows and/or menus should explicitly set the current window and/orcurrent menu and not rely on its current setting.
The amount of computation and rendering done in an idle callback should be minimized to avoid affecting the program's interactive response. In general, not more than a single frame of rendering should be done in an idle callback.
assing NULL to glutIdleFunc disables the generation of the idle callback.
glutIdleFunc設定全局的回調函式,當沒有視窗事件到達時,GLUT程式功能可以執行後台處理任務或連續動畫。如果啟用,這個idle function會被不斷調用,直到有視窗事件發生。回調函式沒有參數。當前的視窗和選單在執行idle func之前不會改變。當程式以來多視窗或選單是最好不要依賴於當前設定。
應儘量減少在空閒回調完成的計算和渲染的數額,以避免影響程式的互動回響。在一般情況下,不超過單幀的渲染工作應在一個空閒回調。
向glutIdleFunc傳遞NULL(0)就可禁用其函式回調。
在glutIdleFunc(void (*func)(void))回調函式中指定一個函式,如果不存在其他尚未完成的事件(例如,當事件循環處於空閒的時候),就執行這個函式。這個回調函式接受一個函式指針作為它的唯一參數。如果向它傳遞NULL(0),就相當于禁用這個函式。

相關詞條

熱門詞條

聯絡我們