OpenGL callback function

Source: Internet
Author: User

Void gludisplayfunc (void (* func) (void ));

Registers the display callback function of the current window.

Parameters:
FUNC: The Void func () function.

This function tells glut that when the window content must be drawn, the function will be called. when the window size is changed, the window is restored from the overwritten state, or the glut is required to be updated by calling the glupostredisplay () function, the function specified by the func parameter is executed.

//************************************** **************************************** *
Void glureshapefunc (void (* func) (INT width, int height ));

Function called when the window size changes

Parameters:
FUNC: shaped like void func (INT width, int height)
Function used to handle window size changes.
Width, height: the length and width after the window is changed.

This function determines a callback function. Whenever the window size or shape changes (including the first creation of the window), Glut will call this function, the callback function accepts the new length and width of the window as the input parameter.

//************************************** **************************************** ***

Void glukeyboardfunc (void (* func) (unsigned char key, int X, int y ));

Register the keyboard callback function of the current window

Parameters:
FUNC: shaped like void func (unsigned char key, int X, int y)
Key: ASCII code of the key
X, Y: the coordinates of the mouse when the key is pressed, in pixels relative to the upper left corner of the window.

It is called when you press the keyboard button (except for the special button, that is, the button processed in gluspecialfunc.

//************************************** ****************************************
Void glumousefunc (void (* func) (INT button, int state, int X, int y ));

Register the mouse callback function of the current window

Parameters:
FUNC: such as void func (INT button, int state, int X, int y );
Button: the mouse button, which is a constant defined below
Glu_left_button: left mouse button
Glu_middle_button: middle mouse button
Glu_right_button: Right-click
State: the action of the mouse button, which is a constant defined below
Glu_up: Mouse release
Glu_down: press the mouse
X, Y: The cursor is relative to the position in the upper left corner of the window.

It is called when you click the mouse.

//************************************** *************************************
Void glumotionfunc (void (* func) (int x, int y ));

Call the callback function registered by glumotionfunc when you press and move the cursor in the window.

Void glupassivemotionfunc (void (* func) (int x, int y ));

When you move the cursor in the window, call the callback function registered by glupassivemotionfunc.

Parameters:
FUNC: such as void func (int x, int y );
X, Y: the position of the cursor in the upper-left corner of the window, in pixels.

//************************************** ***********************************
Void gluentryfunc (void (* func) (INT State ));

Set the callback function for the mouse's incoming and outgoing windows

Parameters:
FUNC: such as void func (INT State); the registered mouse in and out callback function
State: enter or exit state of the mouse, which is one of the following constants.
Glu_left move the mouse out of the window
Enter the window with the mouse

This function is called when the window gets focus or loses focus. When the mouse enters the window area and clicks, the state is maid. When the mouse leaves the window area and clicks another window, the state is maid.

//************************************** **************************************

Void gluvisibilityfunc (void (* func) (INT State ));

Sets the visual callback function of the current window.

Parameters:
FUNC: such as void func (INT State); specifies the visual callback function.
State: Window visibility, which is a constant
The fig window is completely invisible.
Display visible or partially visible

This function sets the visible callback function of the current window. When the visibility of the window changes, the visible callback function of the window is called. as long as any pixel in the window is visible, or any pixel in any of its subwindows is visible, Glut considers the window to be visible.

//************************************** **************************************
Void glutidlefunc (void (* func) (void ));

Set idle callback function

Parameters:
FUNC: such as void func (void );

Called when the system is idle.

//************************************** ************************************
Void glutimerfunc (unsigned int millis, void (* func) (INT value), int value );

Register a callback function. After the specified time value arrives, Glut calls the registered function once.

Parameters:
Millis: the waiting time, in milliseconds.
UNC: such as void func (INT value)
Value: a specified value that is passed to the callback function func.

This function registers a callback function. When the specified number of milliseconds reaches, this function calls the registered function. The value parameter is used to pass parameters to the registered function. but it can only be triggered once. To trigger it continuously, you need to re-set the timer function in func ();

//************************************** **************************************** *
Void glumenustatefunc (void (* func) (INT State ));

Registers the menu status callback function.

Parameters:
FUNC: such as void func (INT State );
State:
Glu_menu_in_use: The menu is used.
Glu_menu_not_in_use: The menu is no longer used, that is, the menu is disabled.
If the State is substituted into glu_menu_in_use, this function is called when the menu is used;
If the State is substituted into glu_menu_not_in_use, this function is called when the menu is closed.

//************************************** ****************************************

Void glumenustatusfunc (void (* func) (INT status, int X, int y ));
Set Menu status callback function
Parameters:
FUNC: such as void func (INT status, int X, int y );
Status: whether to use the menu currently. It is a constant defined below.
Glu_menu_in_use: The menu is in use.
Glu_menu_not_in_use: The menu is not used.
X, Y: Position of the cursor relative to the upper left corner of the window when the mouse is pressed
When this function is called, The glut program determines whether a menu is being used. When a menu is displayed, the registered menu status callback function is called, And the status is set to the constant glu_menu_in_use. When the menu is used up, also, call the menu status callback function. At this time, the status variable changes to maid. from the pop-up menu, no menu status callback process is generated. each glut program has only one menu status callback function. compared with the above function, this function only transmits a cursor position, the other is the same.

//************************************** **************************************** **
Void gluspecialfunc (void (* func) (INT key, int X, int y ));

Set the callback function for the specific key of the current window

Parameters:
FUNC: such as void func (INT key, int X, int y );
Key: the specified key, which is a constant defined below.
Glu_key_f1: F1 function key
Glu_key_f2: F2 function key
Glu_key_f3: F3 function key
Glu_key_f4: F4 function key
Glu_key_f5: F5 function key
Glu_key_f6: F6 function key
Glu_key_f7: F7 function key
Glu_key_f8: F8 function key
Glu_key_f9: F9 function key
Glu_key_f10: F10 function key
Glu_key_f11: F11 function key
Glu_key_f12: F12 function key
Glu_key_left: left direction key
Glu_key_up: The up arrow key.
Glu_key_right: right arrow key
Glu_key_down: downstream key
MAID: Pageup key
MAID: Pagedown key
Glu_key_home: Home Key
Glu_key_end: end key
Glu_key_insert: Insert key
X, Y: the coordinates of the mouse when the key is pressed, in pixels relative to the upper left corner of the window.

Note: The ESC, press enter, and delete keys are generated by the ASCII code, that is, they can be processed using the glukeyboardfunc. this function is called when you press the preceding button on the keyboard. note the difference between it and the glukeyboardfunc.

//************************************** **************************************

Void gluspaceballmotionfunc (void (* func) (int x, int y, int z ));

Registers a callback function for Spaceball translation in the current window.

Parameters:
FUNC: such as void func (int x, int y, int Z );
X, Y, Z: Three-dimensional Coordinate of Spaceball.
Paceball is a special type of mouse with a 3D scroll wheel. It can not only rotate before and after, but also scroll in three-dimensional space. For specific images, you can search in Baidu.

This function is called when Spaceball is translated in the currently registered window.

//************************************** ****************************************
Void gluspaceballrotatefunc (void (* func) (int x, int y, int z ));

Registers a callback function for the Spaceball rotation of the current window.

Parameters:
FUNC: such as void func (int x, int y, int Z );
It is called when Spaceball is rolled in the current registered window.

//************************************** **************************************

Void gluspaceballbuttonfunc (void (* func) (INT button, int State ));

Registers the callback function of the Spaceball button in the current window.

Parameters:
FUNC: such as void func (INT button, int State );
Button: the Key number. Starting from 1, the available key numbers can be queried through the maid (glu_num_spaceball_buttons.
State: button status
Glu_up: press the button to release
Glu_down: press the button

It is called when Spaceball hits the corresponding button in the current window.

//************************************** ****************************************

Void glubuttonboxfunc (void (* func) (INT button, int State ));

Registers the callback function of the dial-up key box in the current window.

Parameters:
FUNC: such as void func (INT button, int State );
Button: the Key number. Starting from 1, the available key numbers can be queried through
State: button status
Glu_up: press the button to release
Glu_down: press the button

It is called when the button in the dial-up key box is pressed.

//************************************** **************************************** ****

Void gludialsfunc (void (* func) (INT dial, int value ));

Register the dial-up callback function of the current window.

Parameters:
FUNC: Form void func (INT dial, value );
Dial: the number of dial. Starting from 1, you can query the available number by using gludeviceget (glu_num_dials.
Value: The value allocated by dial. value is the sum of the value allocated each time until it overflows.

It is called when dialing in the dial-up key box.

//************************************** **************************************** **
Void glutabletmotionfunc (void (* func) (int x, int y ));

Register the graphic board movement callback function

Parameters:
FUNC: such as void func (int x, int y );
X, Y: coordinates of the motion of the graphic board.

Called when the graphic board is moved.

//************************************** ****************************************
Void glutabletbuttonfunc (void (* func) (INT button, int state, int X, int y ));

Registers the graphic board button callback function of the current window.

Parameters:
FUNC: such as void func (INT button, int state, int X, int y );
Button.
State: key status.
Glu_up: the button is pressed.
Glu_down: the button is released.

X, Y: Coordinates relative to the window when the button status changes.

//************************************** ****************************************
Void glutoverlaydisplayfunc (void (* func) (void ));

Registers the display callback function for the relay of the current window.

Parameters:
FUNC: it is like void func (void). It points to the display callback function of the relay layer.

This function tells glut that when the window content must be drawn, the function will be called. when the window size is changed, the window is restored from the overwritten state, or the glut is required to be updated by calling the glupostoverlayredisplay () function, the function specified by the func parameter is executed.

//************************************** **************************************** **

Void gluwindowstatusfunc (void (* func) (INT State ));

Registers the callback function for the current window status.

Parameters:
FUNC: such as void func (INT State );
State: Window status.
Glu_hidden: the window is invisible.
Glu_fully_retained: the window is completely unblocked.
Glu_partially_retained: partial occlusion of the window
Glu_fully_covered: the window is completely blocked.

Called when the window status changes accordingly.

//************************************** *******************************

Void glukeyboardupfunc (void (* func) (unsigned char key, int X, int y ));

Register the callback function for releasing common buttons

Parameters:
FUNC: shaped like void func (unsigned char key, int X, int y );
Key: the ASCII code of the key.
X, Y: the position of the mouse relative to the window when the button is released, in pixels.

Called when a common button is released.

//************************************** *******************************

Void gluspecialupfunc (void (* func) (INT key, int X, int y ));

Register the callback function for releasing special buttons

Parameters:
FUNC: such as void func (INT key, int X, int y );
Key: Special Key Identifier
Glu_key_f1: F1 function key
Glu_key_f2: F2 function key
Glu_key_f3: F3 function key
Glu_key_f4: F4 function key
Glu_key_f5: F5 function key
Glu_key_f6: F6 function key
Glu_key_f7: F7 function key
Glu_key_f8: F8 function key
Glu_key_f9: F9 function key
Glu_key_f10: F10 function key
Glu_key_f11: F11 function key
Glu_key_f12: F12 function key
Glu_key_left: left direction key
Glu_key_up: The up arrow key.
Glu_key_right: right arrow key
Glu_key_down: downstream key
MAID: Pageup key
MAID: Pagedown key
Glu_key_home: Home Key
Glu_key_end: end key
Glu_key_insert: Insert key
X, Y: the position of the mouse relative to the window when a special button is released, in pixels.

Called when a special button is released.

//************************************** ***************************************
Void glujoystickfunc (void (* func) (unsigned int buttonmask, int X, int y, int Z), int pollinterval );

Registers the callback function of the joystick.

Parameters:
Buttonmask: joystick buttons
Glu_joystick_button_a
Glu_joystick_button_ B
Glu_joystick_button_c
Glu_joystick_button_d
X, Y, Z: displacement of the joystick moving in 3D space
Pollinterval: determines the interval between the detection joystick, in milliseconds.

This function is called in two cases:
1. Called within the time interval specified by pollinterval.
2. Call the glujoystickfunc () function once ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.