C# Класс Tao.FreeGlut.Glut

FreeGLUT (OpenGL Utility Toolkit) binding for .NET, implementing FreeGlut 2.4.0.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
GLUT_BITMAP_8_BY_13 System.IntPtr
GLUT_BITMAP_9_BY_15 System.IntPtr
GLUT_BITMAP_HELVETICA_10 System.IntPtr
GLUT_BITMAP_HELVETICA_12 System.IntPtr
GLUT_BITMAP_HELVETICA_18 System.IntPtr
GLUT_BITMAP_TIMES_ROMAN_10 System.IntPtr
GLUT_BITMAP_TIMES_ROMAN_24 System.IntPtr
GLUT_STROKE_MONO_ROMAN IntPtr
GLUT_STROKE_ROMAN IntPtr

Открытые методы

Метод Описание
glutButtonBoxFunc ( [ func ) : void

Sets the dial and button box button callback for the current window.

glutButtonBoxFunc sets the dial and button box button callback for the current window. The dial and button box button callback for a window is called when the window has dial and button box input focus (normally, when the mouse is in the window) and the user generates dial and button box button presses. The button parameter will be the button number (starting at one). The number of available dial and button box buttons can be determined with Glut.glutDeviceGet(Glut.GLUT_NUM_BUTTON_BOX_BUTTONS). The state is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively.

Registering a dial and button box button callback when a dial and button box device is not available is ineffectual and not an error. In this case, no dial and button box button callbacks will be generated.

Passing null to glutButtonBoxFunc disables the generation of dial and button box button callbacks. When a new window is created, no dial and button box button callback is initially registered.

glutCloseFunc ( [ func ) : void

Sets the close callback.

glutCreateMenu ( [ func ) : int

Creates a new pop-up menu.

glutCreateMenu creates a new pop-up menu and returns a unique small integer identifier. The range of allocated identifiers starts at one. The menu identifier range is separate from the window identifier range. Implicitly, the current menu is set to the newly created menu. This menu identifier can be used when calling glutSetMenu.

When the menu callback is called because a menu entry is selected for the menu, the current menu will be implicitly set to the menu with the selected entry before the callback is made.

EXAMPLE

Here is a quick example of how to create a GLUT popup menu with two submenus and attach it to the right button of the current window:

int submenu1, submenu2; submenu1 = Glut.glutCreateMenu(selectMessage); Glut.glutAddMenuEntry("abc", 1); Glut.glutAddMenuEntry("ABC", 2); submenu2 = Glut.glutCreateMenu(selectColor); Glut.glutAddMenuEntry("Green", 1); Glut.glutAddMenuEntry("Red", 2); Glut.glutAddMenuEntry("White", 3); Glut.glutCreateMenu(selectFont); Glut.glutAddMenuEntry("9 by 15", 0); Glut.glutAddMenuEntry("Times Roman 10", 1); Glut.glutAddMenuEntry("Times Roman 24", 2); Glut.glutAddSubMenu("Messages", submenu1); Glut.glutAddSubMenu("Color", submenu2); Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

X IMPLEMENTATION NOTES

If available, GLUT for X will take advantage of overlay planes for implementing pop-up menus. The use of overlay planes can eliminate display callbacks when pop-up menus are deactivated. The SERVER_OVERLAY_VISUALS convention is used to determine if overlay visuals are available.

glutDialsFunc ( [ func ) : void

Sets the dial and button box dials callback for the current window.

glutDialsFunc sets the dial and button box dials callback for the current window. The dial and button box dials callback for a window is called when the window has dial and button box input focus (normally, when the mouse is in the window) and the user generates dial and button box dial changes. The dial parameter will be the dial number (starting at one). The number of available dial and button box dials can be determined with Glut.glutDeviceGet(Glut.GLUT_NUM_DIALS). The val measures the absolute rotation in degrees. Dial values do not "roll over" with each complete rotation but continue to accumulate degrees (until the int dial value overflows).

Registering a dial and button box dials callback when a dial and button box device is not available is ineffectual and not an error. In this case, no dial and button box dials callbacks will be generated.

Passing null to glutDialsFunc disables the generation of dial and button box dials callbacks. When a new window is created, no dial and button box dials callback is initially registered.

glutDisplayFunc ( [ func ) : void

Sets the display callback for the current window.

glutDisplayFunc sets the display callback for the current window. When GLUT determines that the normal plane for the window needs to be redisplayed, the display callback for the window is called. Before the callback, the current window is set to the window needing to be redisplayed and (if no overlay display callback is registered) the layer in use is set to the normal plane. The display callback is called with no parameters. The entire normal plane region should be redisplayed in response to the callback (this includes ancillary buffers if your program depends on their state).

GLUT determines when the display callback should be triggered based on the window's redisplay state. The redisplay state for a window can be either set explicitly by calling glutPostRedisplay or implicitly as the result of window damage reported by the window system. Multiple posted redisplays for a window are coalesced by GLUT to minimize the number of display callbacks called.

When an overlay is established for a window, but there is no overlay display callback registered, the display callback is used for redisplaying both the overlay and normal plane (that is, it will be called if either the redisplay state or overlay redisplay state is set). In this case, the layer in use is not implicitly changed on entry to the display callback.

See glutOverlayDisplayFunc to understand how distinct callbacks for the overlay and normal plane of a window may be established.

When a window is created, no display callback exists for the window. It is the responsibility of the programmer to install a display callback for the window before the window is shown. A display callback must be registered for any window that is shown. If a window becomes displayed without a display callback being registered, a fatal error occurs. Passing null to glutDisplayFunc is illegal as of GLUT 3.0; there is no way to "deregister" a display callback (though another callback routine can always be registered).

Upon return from the display callback, the normal damaged state of the window (returned by calling Glut.glutLayerGet(Glut.GLUT_NORMAL_DAMAGED) is cleared. If there is no overlay display callback registered the overlay damaged state of the window (returned by calling Glut.glutLayerGet(Glut.GLUT_OVERLAY_DAMAGED) is also cleared.

glutEntryFunc ( [ func ) : void

Sets the mouse enter/leave callback for the current window.

glutEntryFunc sets the mouse enter/leave callback for the current window. The state callback parameter is either GLUT_LEFT or GLUT_ENTERED depending on if the mouse pointer has last left or entered the window.

Passing null to glutEntryFunc disables the generation of the mouse enter/leave callback.

Some window systems may not generate accurate enter/leave callbacks.

glutIdleFunc ( [ func ) : void

Sets the global idle callback.

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/or current 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.

Passing null to glutIdleFunc disables the generation of the idle callback.

glutInit ( ) : void

Initializes the GLUT library.

This is a non-standard version of glutInit that passes the appropriate commandline arguments automatically.

glutInit will initialize the GLUT library and negotiate a session with the window system. During this process, glutInit may cause the termination of the GLUT program with an error message to the user if GLUT cannot be properly initialized. Examples of this situation include the failure to connect to the window system, the lack of window system support for OpenGL, and invalid command line options.

glutInit also processes command line options, but the specific options parsed are window system dependent.

X IMPLEMENTATION NOTES

The X Window System specific options parsed by glutInit are as follows:

Value Description -display DISPLAY Specify the X server to connect to. If not specified, the value of the DISPLAY environment variable is used. -geometry WxH+X+Y Determines where window's should be created on the screen. The parameter following -geometry should be formatted as a standard X geometry specification. The effect of using this option is to change the GLUT initial size and initial position the same as if glutInitWindowSize or glutInitWindowPosition were called directly. -iconic Requests all top-level windows be created in an iconic state. -indirect Force the use of indirect OpenGL rendering contexts. -direct

Force the use of direct OpenGL rendering contexts (not all GLX implementations support direct rendering contexts). A fatal error is generated if direct rendering is not supported by the OpenGL implementation.

If neither -indirect or -direct are used to force a particular behavior, GLUT will attempt to use direct rendering if possible and otherwise fallback to indirect rendering.

-gldebug After processing callbacks and/or events, check if there are any OpenGL errors by calling Gl.glGetError. If an error is reported, print out a warning by looking up the error code with /*see cref="Glu.gluErrorString" />*/. Using this option is helpful in detecting OpenGL run-time errors. -sync Enable synchronous X protocol transactions. This option makes it easier to track down potential X protocol errors.

glutJoystickFunc ( [ func, int pollInterval ) : void

Sets the joystick callback for the current window.

glutJoystickFunc sets the joystick callback for the current window.

The joystick callback is called either due to polling of the joystick at the uniform timer interval specified by pollInterval (in milliseconds) or in response to calling glutForceJoystickFunc. If the pollInterval is non-positive, no joystick polling is performed and the GLUT application must frequently (usually from an idle callback) call glutForceJoystickFunc.

The joystick buttons are reported by the callback's buttonMask parameter. The constants GLUT_JOYSTICK_BUTTON_A (0x1), GLUT_JOYSTICK_BUTTON_B (0x2), GLUT_JOYSTICK_BUTTON_C (0x4), and GLUT_JOYSTICK_BUTTON_D (0x8) are provided for programming convience.

The x, y, and z callback parameters report the X, Y, and Z axes of the joystick. The joystick is centered at (0, 0, 0). X, Y, and Z are scaled to range between -1000 and 1000. Moving the joystick left reports negative X; right reports positive X. Pulling the stick towards you reports negative Y; push the stick away from you reports positive Y. If the joystick has a third axis (rudder or up/down), down reports negative Z; up reports positive Z.

Passing a null to glutJoystickFunc disables the generation of joystick callbacks. Without a joystick callback registered, glutForceJoystickFunc does nothing.

When a new window is created, no joystick callback is initially registered.

LIMITATIONS

The GLUT joystick callback only reports the first 3 axes and 32 buttons. GLUT supports only a single joystick.

X IMPLEMENTATION NOTES

The GLUT 3.7 implementation of GLUT for X11 supports the joystick API, but not joystick input. A future implementation of GLUT for X11 may add joystick support.

WIN32 IMPLEMENTATION NOTES

The GLUT 3.7 implementation of GLUT for Win32 supports the joystick API and joystick input, but does so through the dated joySetCapture and joyGetPosEx Win32 Multimedia API. The GLUT 3.7 joystick support for Win32 has all the limitations of the Win32 Multimedia API joystick support. A future implementation of GLUT for Win32 may use DirectInput.

GLUT IMPLEMENTATION NOTES FOR NON-ANALOG JOYSTICKS

If the connected joystick does not return (x, y, z) as a continuous range (for example, an 8 position Atari 2600 joystick), the implementation should report the most extreme (x, y, z) location. That is, if a 2D joystick is pushed to the upper left, report (-1000, 1000, 0).

glutKeyboardFunc ( [ func ) : void

Sets the keyboard callback for the current window.

glutKeyboardFunc sets the keyboard callback for the current window. When a user types into the window, each key press generating an ASCII character will generate a keyboard callback. The key callback parameter is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. The x and y callback parameters indicate the mouse location in window relative coordinates when the key was pressed. When a new window is created, no keyboard callback is initially registered, and ASCII key strokes in the window are ignored. Passing null to glutKeyboardFunc disables the generation of keyboard callbacks.

During a keyboard callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred.

Also, see glutSpecialFunc for a means to detect non-ASCII key strokes.

glutKeyboardUpFunc ( [ func ) : void

Sets the keyboard up (key release) callback for the current window.

glutKeyboardUpFunc sets the keyboard up (key release) callback for the current window. When a user types into the window, each key release matching an ASCII character will generate a keyboard up callback. The key callback parameter is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. The x and y callback parameters indicate the mouse location in window relative coordinates when the key was pressed. When a new window is created, no keyboard callback is initially registered, and ASCII key strokes in the window are ignored. Passing null to glutKeyboardUpFunc disables the generation of keyboard up callbacks.

During a keyboard up callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred.

To avoid the reporting of key release/press pairs due to auto repeat, use glutIgnoreKeyRepeat to ignore auto repeated keystrokes.

There is no guarantee that the keyboard press callback will match the exact ASCII character as the keyboard up callback. For example, the key down may be for a lowercase b, but the key release may report an uppercase B if the shift state has changed. The same applies to symbols and control characters. The precise behavior is window system dependent.

Use glutSpecialUpFunc for a means to detect non-ASCII key release.

glutMenuDestroyFunc ( [ func ) : void

Sets the menu destroy callback.

glutMenuStateFunc ( [ func ) : void

A deprecated version of the glutMenuStatusFunc routine.

The only difference is glutMenuStateFunc callback prototype does not deliver the two additional x and y coordinates.

glutMenuStatusFunc ( [ func ) : void

Sets the global menu status callback.

glutMenuStatusFunc sets the global menu status callback so a GLUT program can determine when a menu is in use or not. When a menu status callback is registered, it will be called with the value GLUT_MENU_IN_USE for its val parameter when pop-up menus are in use by the user; and the callback will be called with the value GLUT_MENU_NOT_IN_USE for its status parameter when pop-up menus are no longer in use. The x and y parameters indicate the location in window coordinates of the button press that caused the menu to go into use, or the location where the menu was released (may be outside the window). The func parameter names the callback function. Other callbacks continue to operate (except mouse motion callbacks) when pop-up menus are in use so the menu status callback allows a program to suspend animation or other tasks when menus are in use. The cascading and unmapping of sub-menus from an initial pop-up menu does not generate menu status callbacks. There is a single menu status callback for GLUT.

When the menu status callback is called, the current menu will be set to the initial pop-up menu in both the GLUT_MENU_IN_USE and GLUT_MENU_NOT_IN_USE cases. The current window will be set to the window from which the initial menu was popped up from, also in both cases.

Passing null to glutMenuStatusFunc disables the generation of the menu status callback.

glutMenuStateFunc is a deprecated version of the glutMenuStatusFunc routine. The only difference is glutMenuStateFunc callback prototype does not deliver the two additional x and y coordinates.

glutMotionFunc ( [ func ) : void

Sets the motion callbacks for the current window.

glutMotionFunc sets the motion callback for the current window. The motion callback for a window is called when the mouse moves within the window while one or more mouse buttons are pressed.

The x and y callback parameters indicate the mouse location in window relative coordinates.

Passing null to glutMotionFunc disables the generation of the motion callback.

glutMouseFunc ( [ func ) : void

Sets the mouse callback for the current window.

glutMouseFunc sets the mouse callback for the current window. When a user presses and releases mouse buttons in the window, each press and each release generates a mouse callback. The button parameter is one of GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, or GLUT_RIGHT_BUTTON. For systems with only two mouse buttons, it may not be possible to generate the GLUT_MIDDLE_BUTTON callback. For systems with a single mouse button, it may be possible to generate only a GLUT_LEFT_BUTTON callback. The state parameter is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively. The x and y callback parameters indicate the window relative coordinates when the mouse button state changed. If a GLUT_DOWN callback for a specific button is triggered, the program can assume a GLUT_UP callback for the same button will be generated (assuming the window still has a mouse callback registered) when the mouse button is released even if the mouse has moved outside the window.

If a menu is attached to a button for a window, mouse callbacks will not be generated for that button.

During a mouse callback, glutGetModifiers may be called to determine the state of modifier keys when the mouse event generating the callback occurred.

Passing null to glutMouseFunc disables the generation of mouse callbacks.

glutMouseWheelFunc ( [ func ) : void

Sets the mouse wheel callback.

glutOverlayDisplayFunc ( [ func ) : void

Sets the overlay display callback for the current window.

glutDisplayFunc sets the overlay display callback for the current window. The overlay display callback is functionally the same as the window's display callback except that the overlay display callback is used to redisplay the window's overlay.

When GLUT determines that the overlay display for the window needs to be redisplayed, the overlay display callback for the window is called. Before the callback, the current window is set to the window needing to be redisplayed and the layer in use is set to the overlay. The overlay display callback is called with no parameters. The entire overlay region should be redisplayed in response to the callback (this includes ancillary buffers if your program depends on their state).

GLUT determines when the overlay display callback should be triggered based on the window's overlay redisplay state. The overlay redisplay state for a window can be either set explicitly by calling glutPostOverlayRedisplay or implicitly as the result of window damage reported by the window system. Multiple posted overlay redisplays for a window are coalesced by GLUT to minimize the number of overlay display callbacks called.

Upon return from the overlay display callback, the overlay damaged state of the window (returned by calling Glut.glutLayerGet(Glut.GLUT_OVERLAY_DAMAMGED) is cleared.

The overlay display callback can be deregistered by passing null to glutOverlayDisplayFunc. The overlay display callback is initially null when an overlay is established. See glutDisplayFunc to understand how the display callback alone is used if an overlay display callback is not registered.

glutPassiveMotionFunc ( [ func ) : void

Sets the passive motion callbacks for the current window.

glutPassiveMotionFunc sets the passive motion callback for the current window. The passive motion callback for a window is called when the mouse moves within the window while no mouse buttons are pressed.

The x and y callback parameters indicate the mouse location in window relative coordinates.

Passing null to glutPassiveMotionFunc disables the generation of the passive motion callback.

glutReshapeFunc ( [ func ) : void

Sets the reshape callback for the current window.

glutReshapeFunc sets the reshape callback for the current window. The reshape callback is triggered when a window is reshaped. A reshape callback is also triggered immediately before a window's first display callback after a window is created or whenever an overlay for the window is established. The width and height parameters of the callback specify the new window size in pixels. Before the callback, the current window is set to the window that has been reshaped.

If a reshape callback is not registered for a window or null is passed to glutReshapeFunc (to deregister a previously registered callback), the default reshape callback is used. This default callback will simply call Gl.glViewport(0, 0, width, height) on the normal plane (and on the overlay if one exists).

If an overlay is established for the window, a single reshape callback is generated. It is the callback's responsibility to update both the normal plane and overlay for the window (changing the layer in use as necessary).

When a top-level window is reshaped, subwindows are not reshaped. It is up to the GLUT program to manage the size and positions of subwindows within a top-level window. Still, reshape callbacks will be triggered for subwindows when their size is changed using glutReshapeWindow.

glutSpaceballButtonFunc ( [ func ) : void

Sets the Spaceball button callback for the current window.

glutSpaceballButtonFunc sets the Spaceball button callback for the current window. The Spaceball button callback for a window is called when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball button presses. The button parameter will be the button number (starting at one). The number of available Spaceball buttons can be determined with glutDeviceGet(GLUT_NUM_SPACEBALL_BUTTONS). The state is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively.

Registering a Spaceball button callback when a Spaceball device is not available is ineffectual and not an error. In this case, no Spaceball button callbacks will be generated.

Passing null to glutSpaceballButtonFunc disables the generation of Spaceball button callbacks. When a new window is created, no Spaceball button callback is initially registered.

glutSpaceballMotionFunc ( [ func ) : void

Sets the Spaceball motion callback for the current window.

glutSpaceballMotionFunc sets the Spaceball motion callback for the current window. The Spaceball motion callback for a window is called when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball translations. The x, y, and z callback parameters indicate the translations along the X, Y, and Z axes. The callback parameters are normalized to be within the range of -1000 to 1000 inclusive.

Registering a Spaceball motion callback when a Spaceball device is not available has no effect and is not an error. In this case, no Spaceball motion callbacks will be generated.

Passing null to glutSpaceballMotionFunc disables the generation of Spaceball motion callbacks. When a new window is created, no Spaceball motion callback is initially registered.

glutSpaceballRotateFunc ( [ func ) : void

Sets the Spaceball rotation callback for the current window.

glutSpaceballRotateFunc sets the Spaceball rotate callback for the current window. The Spaceball rotate callback for a window is called when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball rotations. The x, y, and z callback parameters indicate the rotation along the X, Y, and Z axes. The callback parameters are normalized to be within the range of -1800 to 1800 inclusive.

Registering a Spaceball rotate callback when a Spaceball device is not available is ineffectual and not an error. In this case, no Spaceball rotate callbacks will be generated.

Passing null to glutSpaceballRotateFunc disables the generation of Spaceball rotate callbacks. When a new window is created, no Spaceball rotate callback is initially registered.

glutSpecialFunc ( [ func ) : void

Sets the special keyboard callback for the current window.

glutSpecialFunc sets the special keyboard callback for the current window. The special keyboard callback is triggered when keyboard function or directional keys are pressed. The key callback parameter is a GLUT_KEY_* constant for the special key pressed. The x and y callback parameters indicate the mouse in window relative coordinates when the key was pressed. When a new window is created, no special callback is initially registered and special key strokes in the window are ignored. Passing null to glutSpecialFunc disables the generation of special callbacks.

During a special callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred.

An implementation should do its best to provide ways to generate all the GLUT_KEY_* special keys. The available GLUT_KEY_* values are:

Value Description GLUT_KEY_F1 F1 function key. GLUT_KEY_F2 F2 function key. GLUT_KEY_F3 F3 function key. GLUT_KEY_F4 F4 function key. GLUT_KEY_F5 F5 function key. GLUT_KEY_F6 F6 function key. GLUT_KEY_F7 F7 function key. GLUT_KEY_F8 F8 function key. GLUT_KEY_F9 F9 function key. GLUT_KEY_F10 F10 function key. GLUT_KEY_F11 F11 function key. GLUT_KEY_F12 F12 function key. GLUT_KEY_LEFT Left directional key. GLUT_KEY_UP Up directional key. GLUT_KEY_RIGHT Right directional key. GLUT_KEY_DOWN Down directional key. GLUT_KEY_PAGE_UP Page up directional key. GLUT_KEY_PAGE_DOWN Page down directional key. GLUT_KEY_HOME Home directional key. GLUT_KEY_END End directional key. GLUT_KEY_INSERT Insert directional key.

Note that the escape, backspace, and delete keys are generated as an ASCII character.

glutSpecialUpFunc ( [ func ) : void

Sets the special keyboard up (key release) callback for the current window.

glutSpecialUpFunc sets the special keyboard up (key release) callback for the current window. The special keyboard up callback is triggered when keyboard function or directional keys are released. The key callback parameter is a GLUT_KEY_* constant for the special key pressed. The x and y callback parameters indicate the mouse in window relative coordinates when the key was pressed. When a new window is created, no special up callback is initially registered and special key releases in the window are ignored. Passing null to glutSpecialUpFunc disables the generation of special up callbacks.

During a special up callback, glutGetModifiers may be called to determine the state of modifier keys when the key release generating the callback occurred.

To avoid the reporting of key release/press pairs due to auto repeat, use glutIgnoreKeyRepeat to ignore auto repeated keystrokes.

An implementation should do its best to provide ways to generate all the GLUT_KEY_* special keys. The available GLUT_KEY_* values are:

Value Description GLUT_KEY_F1 F1 function key. GLUT_KEY_F2 F2 function key. GLUT_KEY_F3 F3 function key. GLUT_KEY_F4 F4 function key. GLUT_KEY_F5 F5 function key. GLUT_KEY_F6 F6 function key. GLUT_KEY_F7 F7 function key. GLUT_KEY_F8 F8 function key. GLUT_KEY_F9 F9 function key. GLUT_KEY_F10 F10 function key. GLUT_KEY_F11 F11 function key. GLUT_KEY_F12 F12 function key. GLUT_KEY_LEFT Left directional key. GLUT_KEY_UP Up directional key. GLUT_KEY_RIGHT Right directional key. GLUT_KEY_DOWN Down directional key. GLUT_KEY_PAGE_UP Page up directional key. GLUT_KEY_PAGE_DOWN Page down directional key. GLUT_KEY_HOME Home directional key. GLUT_KEY_END End directional key. GLUT_KEY_INSERT Insert directional key.

Note that the escape, backspace, and delete keys are generated as an ASCII character.

glutTabletButtonFunc ( [ func ) : void

Sets the tablet button callback for the current window.

glutTabletButtonFunc sets the tablet button callback for the current window. The tablet button callback for a window is called when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet button presses. The button parameter will be the button number (starting at one). The number of available tablet buttons can be determined with Glut.glutDeviceGet(Glut.GLUT_NUM_TABLET_BUTTONS). The state is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively. The x and y callback parameters indicate the window relative coordinates when the tablet button state changed.

Registering a tablet button callback when a tablet device is not available is ineffectual and not an error. In this case, no tablet button callbacks will be generated.

Passing null to glutTabletButtonFunc disables the generation of tablet button callbacks. When a new window is created, no tablet button callback is initially registered.

glutTabletMotionFunc ( [ func ) : void

Sets the tablet motion callback for the current window.

glutTabletMotionFunc sets the tablet motion callback for the current window. The tablet motion callback for a window is called when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet motion. The x and y callback parameters indicate the absolute position of the tablet "puck" on the tablet. The callback parameters are normalized to be within the range of 0 to 2000 inclusive.

Registering a tablet motion callback when a tablet device is not available is ineffectual and not an error. In this case, no tablet motion callbacks will be generated.

Passing null to glutTabletMotionFunc disables the generation of tablet motion callbacks. When a new window is created, no tablet motion callback is initially registered.

glutTimerFunc ( int msecs, [ func, int val ) : void

Registers a timer callback to be triggered in a specified number of milliseconds.

glutTimerFunc registers the timer callback func to be triggered in at least msecs milliseconds. The val parameter to the timer callback will be the value of the val parameter to glutTimerFunc. Multiple timer callbacks at same or differing times may be registered simultaneously.

The number of milliseconds is a lower bound on the time before the callback is generated. GLUT attempts to deliver the timer callback as soon as possible after the expiration of the callback's time interval.

There is no support for canceling a registered callback. Instead, ignore a callback based on its val parameter when it is triggered.

glutVisibilityFunc ( [ func ) : void

Sets the visibility callback for the current window.

glutVisibilityFunc sets the visibility callback for the current window. The visibility callback for a window is called when the visibility of a window changes. The state callback parameter is either GLUT_NOT_VISIBLE or GLUT_VISIBLE depending on the current visibility of the window. GLUT_VISIBLE does not distinguish a window being totally versus partially visible. GLUT_NOT_VISIBLE means no part of the window is visible, i.e., until the window's visibility changes, all further rendering to the window is discarded.

GLUT considers a window visible if any pixel of the window is visible or any pixel of any descendant window is visible on the screen.

Passing null to glutVisibilityFunc disables the generation of the visibility callback.

If the visibility callback for a window is disabled and later re-enabled, the visibility status of the window is undefined; any change in window visibility will be reported, that is if you disable a visibility callback and re-enable the callback, you are guaranteed the next visibility change will be reported.

glutWMCloseFunc ( [ func ) : void

Sets the window close callback for the current window.

glutWindowStatusFunc ( [ func ) : void

Sets the window status callback for the current window.

glutWindowStatusFunc sets the window status callback for the current window. The window status callback for a window is called when the window status (visibility) of a window changes. The state callback parameter is one of GLUT_HIDDEN, GLUT_FULLY_RETAINED, GLUT_PARTIALLY_RETAINED, or GLUT_FULLY_COVERED depending on the current window status of the window. GLUT_HIDDEN means that the window is either not shown (often meaning that the window is iconified). GLUT_FULLY_RETAINED means that the window is fully retained (no pixels belonging to the window are covered by other windows). GLUT_PARTIALLY_RETAINED means that the window is partially retained (some but not all pixels belonging to the window are covered by other windows). GLUT_FULLY_COVERED means the window is shown but no part of the window is visible, i.e., until the window's status changes, all further rendering to the window is discarded.

GLUT considers a window visible if any pixel of the window is visible or any pixel of any descendant window is visible on the screen.

GLUT applications are encouraged to disable rendering and/or animation when windows have a status of either GLUT_HIDDEN or GLUT_FULLY_COVERED.

Passing null to glutWindowStatusFunc disables the generation of the window status callback.

If the window status callback for a window is disabled and later re-enabled, the window status of the window is undefined; any change in window window status will be reported, that is if you disable a window status callback and re-enable the callback, you are guaranteed the next window status change will be reported.

Setting the window status callback for a window disables the visibility callback set for the window (and vice versa). The visibility callback is set with glutVisibilityFunc. glutVisibilityFunc is deprecated in favor of the more informative glutWindowStatusFunc.

Приватные методы

Метод Описание
Glut ( ) : System

Static Glut constructor.

Sets up GLUT font addresses.

__glutButtonBoxFunc ( ButtonBoxCallback func ) : void
__glutCloseFunc ( CloseCallback func ) : void
__glutCreateMenu ( [ func ) : int
__glutDialsFunc ( DialsCallback func ) : void
__glutDisplayFunc ( DisplayCallback func ) : void
__glutEntryFunc ( EntryCallback func ) : void
__glutIdleFunc ( IdleCallback func ) : void
__glutJoystickFunc ( JoystickCallback func, int pollInterval ) : void
__glutKeyboardFunc ( KeyboardCallback func ) : void
__glutKeyboardUpFunc ( KeyboardUpCallback func ) : void
__glutMenuDestroyFunc ( MenuDestroyCallback func ) : void
__glutMenuStateFunc ( MenuStateCallback func ) : void
__glutMenuStatusFunc ( MenuStatusCallback func ) : void
__glutMotionFunc ( MotionCallback func ) : void
__glutMouseFunc ( MouseCallback func ) : void
__glutMouseWheelFunc ( MouseWheelCallback func ) : void
__glutOverlayDisplayFunc ( OverlayDisplayCallback func ) : void
__glutPassiveMotionFunc ( PassiveMotionCallback func ) : void
__glutReshapeFunc ( ReshapeCallback func ) : void
__glutSpaceballButtonFunc ( SpaceballButtonCallback func ) : void
__glutSpaceballMotionFunc ( SpaceballMotionCallback func ) : void
__glutSpaceballRotateFunc ( SpaceballRotateCallback func ) : void
__glutSpecialFunc ( SpecialCallback func ) : void
__glutSpecialUpFunc ( SpecialUpCallback func ) : void
__glutTabletButtonFunc ( TabletButtonCallback func ) : void
__glutTabletMotionFunc ( TabletMotionCallback func ) : void
__glutTimerFunc ( int msecs, TimerCallback func, int val ) : void
__glutVisibilityFunc ( VisibilityCallback func ) : void
__glutWMCloseFunc ( WindowCloseCallback func ) : void
__glutWindowStatusFunc ( WindowStatusCallback func ) : void
glutAddMenuEntry ( string name, int val ) : void
glutAddSubMenu ( string name, int menu ) : void
glutAttachMenu ( int button ) : void
glutBitmapCharacter ( [ font, int character ) : void
glutBitmapHeight ( IntPtr font ) : int
glutBitmapLength ( [ font, string text ) : int
glutBitmapString ( IntPtr font, string str ) : void
glutBitmapWidth ( [ font, int character ) : int
glutChangeToMenuEntry ( int entry, string name, int val ) : void
glutChangeToSubMenu ( int entry, string name, int menu ) : void
glutCopyColormap ( int win ) : void
glutCreateSubWindow ( int win, int x, int y, int width, int height ) : int
glutCreateWindow ( string name ) : int
glutDestroyMenu ( int menu ) : void
glutDestroyWindow ( int win ) : void
glutDetachMenu ( int button ) : void
glutDeviceGet ( int info ) : int
glutEnterGameMode ( ) : int
glutEstablishOverlay ( ) : void
glutExtensionSupported ( string extension ) : int
glutForceJoystickFunc ( ) : void
glutFullScreen ( ) : void
glutGameModeGet ( int mode ) : int
glutGameModeString ( string str ) : void
glutGet ( int state ) : int
glutGetColor ( int cell, int component ) : float
glutGetMenu ( ) : int
glutGetMenuData ( ) : IntPtr
glutGetModifiers ( ) : int
glutGetProcAddress ( string procName ) : IntPtr
glutGetWindow ( ) : int
glutGetWindowData ( ) : IntPtr
glutHideOverlay ( ) : void
glutHideWindow ( ) : void
glutIconifyWindow ( ) : void
glutIgnoreKeyRepeat ( int ignore ) : void
glutInit ( int &argcp, StringBuilder argv ) : void
glutInitDisplayMode ( int mode ) : void
glutInitDisplayString ( string str ) : void
glutInitWindowPosition ( int x, int y ) : void
glutInitWindowSize ( int width, int height ) : void
glutLayerGet ( int info ) : int
glutLeaveGameMode ( ) : void
glutLeaveMainLoop ( ) : void
glutMainLoop ( ) : void
glutMainLoopEvent ( ) : void
glutPopWindow ( ) : void
glutPositionWindow ( int x, int y ) : void
glutPostOverlayRedisplay ( ) : void
glutPostRedisplay ( ) : void
glutPostWindowOverlayRedisplay ( int win ) : void
glutPostWindowRedisplay ( int win ) : void
glutPushWindow ( ) : void
glutRemoveMenuItem ( int entry ) : void
glutRemoveOverlay ( ) : void
glutReportErrors ( ) : void
glutReshapeWindow ( int width, int height ) : void
glutSetColor ( int cell, float red, float green, float blue ) : void
glutSetCursor ( int cursor ) : void
glutSetIconTitle ( string name ) : void
glutSetKeyRepeat ( int repeatMode ) : void
glutSetMenu ( int menu ) : void
glutSetMenuData ( IntPtr data ) : void
glutSetOption ( int optionFlag, int value ) : void
glutSetWindow ( int win ) : void
glutSetWindowTitle ( string name ) : void
glutSetupVideoResizing ( ) : void
glutSetupWindowData ( IntPtr data ) : void
glutShowOverlay ( ) : void
glutShowWindow ( ) : void
glutSolidCone ( double baseRadius, double height, int slices, int stacks ) : void
glutSolidCube ( double size ) : void
glutSolidCylinder ( double radius, double height, int slices, int stacks ) : void
glutSolidDodecahedron ( ) : void
glutSolidIcosahedron ( ) : void
glutSolidOctahedron ( ) : void
glutSolidRhombicDodecahedron ( ) : void
glutSolidSierpinskiSponge ( int levels, double offset, double scale ) : void
glutSolidSphere ( double radius, int slices, int stacks ) : void
glutSolidTeapot ( double size ) : void
glutSolidTetrahedron ( ) : void
glutSolidTorus ( double innerRadius, double outerRadius, int sides, int rings ) : void
glutStopVideoResizing ( ) : void
glutStrokeCharacter ( [ font, int character ) : void
glutStrokeHeight ( IntPtr font ) : float
glutStrokeLength ( IntPtr font, string text ) : int
glutStrokeString ( IntPtr font, string str ) : void
glutStrokeWidth ( [ font, int character ) : int
glutSwapBuffers ( ) : void
glutUseLayer ( int layer ) : void
glutVideoPan ( int x, int y, int width, int height ) : void
glutVideoResize ( int x, int y, int width, int height ) : void
glutVideoResizeGet ( int param ) : int
glutWarpPointer ( int x, int y ) : void
glutWireCone ( double baseRadius, double height, int slices, int stacks ) : void
glutWireCube ( double size ) : void
glutWireCylinder ( double radius, double height, int slices, int stacks ) : void
glutWireDodecahedron ( ) : void
glutWireIcosahedron ( ) : void
glutWireOctahedron ( ) : void
glutWireRhombicDodecahedron ( ) : void
glutWireSierpinskiSponge ( int levels, double offset, double scale ) : void
glutWireSphere ( double radius, int slices, int stacks ) : void
glutWireTeapot ( double size ) : void
glutWireTetrahedron ( ) : void
glutWireTorus ( double innerRadius, double outerRadius, int sides, int rings ) : void

Описание методов

glutButtonBoxFunc() публичный статический Метод

Sets the dial and button box button callback for the current window.

glutButtonBoxFunc sets the dial and button box button callback for the current window. The dial and button box button callback for a window is called when the window has dial and button box input focus (normally, when the mouse is in the window) and the user generates dial and button box button presses. The button parameter will be the button number (starting at one). The number of available dial and button box buttons can be determined with Glut.glutDeviceGet(Glut.GLUT_NUM_BUTTON_BOX_BUTTONS). The state is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively.

Registering a dial and button box button callback when a dial and button box device is not available is ineffectual and not an error. In this case, no dial and button box button callbacks will be generated.

Passing null to glutButtonBoxFunc disables the generation of dial and button box button callbacks. When a new window is created, no dial and button box button callback is initially registered.

public static glutButtonBoxFunc ( [ func ) : void
func [ /// The new button box callback function. See . ///
Результат void

glutCloseFunc() публичный статический Метод

Sets the close callback.
public static glutCloseFunc ( [ func ) : void
func [ /// The new close callback function. See . ///
Результат void

glutCreateMenu() публичный статический Метод

Creates a new pop-up menu.

glutCreateMenu creates a new pop-up menu and returns a unique small integer identifier. The range of allocated identifiers starts at one. The menu identifier range is separate from the window identifier range. Implicitly, the current menu is set to the newly created menu. This menu identifier can be used when calling glutSetMenu.

When the menu callback is called because a menu entry is selected for the menu, the current menu will be implicitly set to the menu with the selected entry before the callback is made.

EXAMPLE

Here is a quick example of how to create a GLUT popup menu with two submenus and attach it to the right button of the current window:

int submenu1, submenu2; submenu1 = Glut.glutCreateMenu(selectMessage); Glut.glutAddMenuEntry("abc", 1); Glut.glutAddMenuEntry("ABC", 2); submenu2 = Glut.glutCreateMenu(selectColor); Glut.glutAddMenuEntry("Green", 1); Glut.glutAddMenuEntry("Red", 2); Glut.glutAddMenuEntry("White", 3); Glut.glutCreateMenu(selectFont); Glut.glutAddMenuEntry("9 by 15", 0); Glut.glutAddMenuEntry("Times Roman 10", 1); Glut.glutAddMenuEntry("Times Roman 24", 2); Glut.glutAddSubMenu("Messages", submenu1); Glut.glutAddSubMenu("Color", submenu2); Glut.glutAttachMenu(Glut.GLUT_RIGHT_BUTTON);

X IMPLEMENTATION NOTES

If available, GLUT for X will take advantage of overlay planes for implementing pop-up menus. The use of overlay planes can eliminate display callbacks when pop-up menus are deactivated. The SERVER_OVERLAY_VISUALS convention is used to determine if overlay visuals are available.

public static glutCreateMenu ( [ func ) : int
func [ /// The callback function for the menu that is called when a menu entry from the /// menu is selected. The value passed to the callback is determined by the value /// for the selected menu entry. See . ///
Результат int

glutDialsFunc() публичный статический Метод

Sets the dial and button box dials callback for the current window.

glutDialsFunc sets the dial and button box dials callback for the current window. The dial and button box dials callback for a window is called when the window has dial and button box input focus (normally, when the mouse is in the window) and the user generates dial and button box dial changes. The dial parameter will be the dial number (starting at one). The number of available dial and button box dials can be determined with Glut.glutDeviceGet(Glut.GLUT_NUM_DIALS). The val measures the absolute rotation in degrees. Dial values do not "roll over" with each complete rotation but continue to accumulate degrees (until the int dial value overflows).

Registering a dial and button box dials callback when a dial and button box device is not available is ineffectual and not an error. In this case, no dial and button box dials callbacks will be generated.

Passing null to glutDialsFunc disables the generation of dial and button box dials callbacks. When a new window is created, no dial and button box dials callback is initially registered.

public static glutDialsFunc ( [ func ) : void
func [ /// The new dials callback function. See . ///
Результат void

glutDisplayFunc() публичный статический Метод

Sets the display callback for the current window.

glutDisplayFunc sets the display callback for the current window. When GLUT determines that the normal plane for the window needs to be redisplayed, the display callback for the window is called. Before the callback, the current window is set to the window needing to be redisplayed and (if no overlay display callback is registered) the layer in use is set to the normal plane. The display callback is called with no parameters. The entire normal plane region should be redisplayed in response to the callback (this includes ancillary buffers if your program depends on their state).

GLUT determines when the display callback should be triggered based on the window's redisplay state. The redisplay state for a window can be either set explicitly by calling glutPostRedisplay or implicitly as the result of window damage reported by the window system. Multiple posted redisplays for a window are coalesced by GLUT to minimize the number of display callbacks called.

When an overlay is established for a window, but there is no overlay display callback registered, the display callback is used for redisplaying both the overlay and normal plane (that is, it will be called if either the redisplay state or overlay redisplay state is set). In this case, the layer in use is not implicitly changed on entry to the display callback.

See glutOverlayDisplayFunc to understand how distinct callbacks for the overlay and normal plane of a window may be established.

When a window is created, no display callback exists for the window. It is the responsibility of the programmer to install a display callback for the window before the window is shown. A display callback must be registered for any window that is shown. If a window becomes displayed without a display callback being registered, a fatal error occurs. Passing null to glutDisplayFunc is illegal as of GLUT 3.0; there is no way to "deregister" a display callback (though another callback routine can always be registered).

Upon return from the display callback, the normal damaged state of the window (returned by calling Glut.glutLayerGet(Glut.GLUT_NORMAL_DAMAGED) is cleared. If there is no overlay display callback registered the overlay damaged state of the window (returned by calling Glut.glutLayerGet(Glut.GLUT_OVERLAY_DAMAGED) is also cleared.

public static glutDisplayFunc ( [ func ) : void
func [ /// The new display callback function. See . ///
Результат void

glutEntryFunc() публичный статический Метод

Sets the mouse enter/leave callback for the current window.

glutEntryFunc sets the mouse enter/leave callback for the current window. The state callback parameter is either GLUT_LEFT or GLUT_ENTERED depending on if the mouse pointer has last left or entered the window.

Passing null to glutEntryFunc disables the generation of the mouse enter/leave callback.

Some window systems may not generate accurate enter/leave callbacks.

public static glutEntryFunc ( [ func ) : void
func [ /// The new entry callback function. See . ///
Результат void

glutIdleFunc() публичный статический Метод

Sets the global idle callback.

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/or current 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.

Passing null to glutIdleFunc disables the generation of the idle callback.

public static glutIdleFunc ( [ func ) : void
func [ /// The new idle callback function. See . ///
Результат void

glutInit() публичный статический Метод

Initializes the GLUT library.

This is a non-standard version of glutInit that passes the appropriate commandline arguments automatically.

glutInit will initialize the GLUT library and negotiate a session with the window system. During this process, glutInit may cause the termination of the GLUT program with an error message to the user if GLUT cannot be properly initialized. Examples of this situation include the failure to connect to the window system, the lack of window system support for OpenGL, and invalid command line options.

glutInit also processes command line options, but the specific options parsed are window system dependent.

X IMPLEMENTATION NOTES

The X Window System specific options parsed by glutInit are as follows:

Value Description -display DISPLAY Specify the X server to connect to. If not specified, the value of the DISPLAY environment variable is used. -geometry WxH+X+Y Determines where window's should be created on the screen. The parameter following -geometry should be formatted as a standard X geometry specification. The effect of using this option is to change the GLUT initial size and initial position the same as if glutInitWindowSize or glutInitWindowPosition were called directly. -iconic Requests all top-level windows be created in an iconic state. -indirect Force the use of indirect OpenGL rendering contexts. -direct

Force the use of direct OpenGL rendering contexts (not all GLX implementations support direct rendering contexts). A fatal error is generated if direct rendering is not supported by the OpenGL implementation.

If neither -indirect or -direct are used to force a particular behavior, GLUT will attempt to use direct rendering if possible and otherwise fallback to indirect rendering.

-gldebug After processing callbacks and/or events, check if there are any OpenGL errors by calling Gl.glGetError. If an error is reported, print out a warning by looking up the error code with /*see cref="Glu.gluErrorString" />*/. Using this option is helpful in detecting OpenGL run-time errors. -sync Enable synchronous X protocol transactions. This option makes it easier to track down potential X protocol errors.

public static glutInit ( ) : void
Результат void

glutJoystickFunc() публичный статический Метод

Sets the joystick callback for the current window.

glutJoystickFunc sets the joystick callback for the current window.

The joystick callback is called either due to polling of the joystick at the uniform timer interval specified by pollInterval (in milliseconds) or in response to calling glutForceJoystickFunc. If the pollInterval is non-positive, no joystick polling is performed and the GLUT application must frequently (usually from an idle callback) call glutForceJoystickFunc.

The joystick buttons are reported by the callback's buttonMask parameter. The constants GLUT_JOYSTICK_BUTTON_A (0x1), GLUT_JOYSTICK_BUTTON_B (0x2), GLUT_JOYSTICK_BUTTON_C (0x4), and GLUT_JOYSTICK_BUTTON_D (0x8) are provided for programming convience.

The x, y, and z callback parameters report the X, Y, and Z axes of the joystick. The joystick is centered at (0, 0, 0). X, Y, and Z are scaled to range between -1000 and 1000. Moving the joystick left reports negative X; right reports positive X. Pulling the stick towards you reports negative Y; push the stick away from you reports positive Y. If the joystick has a third axis (rudder or up/down), down reports negative Z; up reports positive Z.

Passing a null to glutJoystickFunc disables the generation of joystick callbacks. Without a joystick callback registered, glutForceJoystickFunc does nothing.

When a new window is created, no joystick callback is initially registered.

LIMITATIONS

The GLUT joystick callback only reports the first 3 axes and 32 buttons. GLUT supports only a single joystick.

X IMPLEMENTATION NOTES

The GLUT 3.7 implementation of GLUT for X11 supports the joystick API, but not joystick input. A future implementation of GLUT for X11 may add joystick support.

WIN32 IMPLEMENTATION NOTES

The GLUT 3.7 implementation of GLUT for Win32 supports the joystick API and joystick input, but does so through the dated joySetCapture and joyGetPosEx Win32 Multimedia API. The GLUT 3.7 joystick support for Win32 has all the limitations of the Win32 Multimedia API joystick support. A future implementation of GLUT for Win32 may use DirectInput.

GLUT IMPLEMENTATION NOTES FOR NON-ANALOG JOYSTICKS

If the connected joystick does not return (x, y, z) as a continuous range (for example, an 8 position Atari 2600 joystick), the implementation should report the most extreme (x, y, z) location. That is, if a 2D joystick is pushed to the upper left, report (-1000, 1000, 0).

public static glutJoystickFunc ( [ func, int pollInterval ) : void
func [ /// The new joystick callback function. See . ///
pollInterval int /// Joystick polling interval in milliseconds. ///
Результат void

glutKeyboardFunc() публичный статический Метод

Sets the keyboard callback for the current window.

glutKeyboardFunc sets the keyboard callback for the current window. When a user types into the window, each key press generating an ASCII character will generate a keyboard callback. The key callback parameter is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. The x and y callback parameters indicate the mouse location in window relative coordinates when the key was pressed. When a new window is created, no keyboard callback is initially registered, and ASCII key strokes in the window are ignored. Passing null to glutKeyboardFunc disables the generation of keyboard callbacks.

During a keyboard callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred.

Also, see glutSpecialFunc for a means to detect non-ASCII key strokes.

public static glutKeyboardFunc ( [ func ) : void
func [ /// The new keyboard callback function. See . ///
Результат void

glutKeyboardUpFunc() публичный статический Метод

Sets the keyboard up (key release) callback for the current window.

glutKeyboardUpFunc sets the keyboard up (key release) callback for the current window. When a user types into the window, each key release matching an ASCII character will generate a keyboard up callback. The key callback parameter is the generated ASCII character. The state of modifier keys such as Shift cannot be determined directly; their only effect will be on the returned ASCII data. The x and y callback parameters indicate the mouse location in window relative coordinates when the key was pressed. When a new window is created, no keyboard callback is initially registered, and ASCII key strokes in the window are ignored. Passing null to glutKeyboardUpFunc disables the generation of keyboard up callbacks.

During a keyboard up callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred.

To avoid the reporting of key release/press pairs due to auto repeat, use glutIgnoreKeyRepeat to ignore auto repeated keystrokes.

There is no guarantee that the keyboard press callback will match the exact ASCII character as the keyboard up callback. For example, the key down may be for a lowercase b, but the key release may report an uppercase B if the shift state has changed. The same applies to symbols and control characters. The precise behavior is window system dependent.

Use glutSpecialUpFunc for a means to detect non-ASCII key release.

public static glutKeyboardUpFunc ( [ func ) : void
func [ /// The new keyboard up callback function. See . ///
Результат void

glutMenuDestroyFunc() публичный статический Метод

Sets the menu destroy callback.
public static glutMenuDestroyFunc ( [ func ) : void
func [ /// The new menu destroy callback function. See . ///
Результат void

glutMenuStateFunc() публичный статический Метод

A deprecated version of the glutMenuStatusFunc routine.
The only difference is glutMenuStateFunc callback prototype does not deliver the two additional x and y coordinates.
public static glutMenuStateFunc ( [ func ) : void
func [ /// The new menu state callback function. . ///
Результат void

glutMenuStatusFunc() публичный статический Метод

Sets the global menu status callback.

glutMenuStatusFunc sets the global menu status callback so a GLUT program can determine when a menu is in use or not. When a menu status callback is registered, it will be called with the value GLUT_MENU_IN_USE for its val parameter when pop-up menus are in use by the user; and the callback will be called with the value GLUT_MENU_NOT_IN_USE for its status parameter when pop-up menus are no longer in use. The x and y parameters indicate the location in window coordinates of the button press that caused the menu to go into use, or the location where the menu was released (may be outside the window). The func parameter names the callback function. Other callbacks continue to operate (except mouse motion callbacks) when pop-up menus are in use so the menu status callback allows a program to suspend animation or other tasks when menus are in use. The cascading and unmapping of sub-menus from an initial pop-up menu does not generate menu status callbacks. There is a single menu status callback for GLUT.

When the menu status callback is called, the current menu will be set to the initial pop-up menu in both the GLUT_MENU_IN_USE and GLUT_MENU_NOT_IN_USE cases. The current window will be set to the window from which the initial menu was popped up from, also in both cases.

Passing null to glutMenuStatusFunc disables the generation of the menu status callback.

glutMenuStateFunc is a deprecated version of the glutMenuStatusFunc routine. The only difference is glutMenuStateFunc callback prototype does not deliver the two additional x and y coordinates.

public static glutMenuStatusFunc ( [ func ) : void
func [ /// The new menu status button callback function. See /// . ///
Результат void

glutMotionFunc() публичный статический Метод

Sets the motion callbacks for the current window.

glutMotionFunc sets the motion callback for the current window. The motion callback for a window is called when the mouse moves within the window while one or more mouse buttons are pressed.

The x and y callback parameters indicate the mouse location in window relative coordinates.

Passing null to glutMotionFunc disables the generation of the motion callback.

public static glutMotionFunc ( [ func ) : void
func [ /// The new motion callback function. See . ///
Результат void

glutMouseFunc() публичный статический Метод

Sets the mouse callback for the current window.

glutMouseFunc sets the mouse callback for the current window. When a user presses and releases mouse buttons in the window, each press and each release generates a mouse callback. The button parameter is one of GLUT_LEFT_BUTTON, GLUT_MIDDLE_BUTTON, or GLUT_RIGHT_BUTTON. For systems with only two mouse buttons, it may not be possible to generate the GLUT_MIDDLE_BUTTON callback. For systems with a single mouse button, it may be possible to generate only a GLUT_LEFT_BUTTON callback. The state parameter is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively. The x and y callback parameters indicate the window relative coordinates when the mouse button state changed. If a GLUT_DOWN callback for a specific button is triggered, the program can assume a GLUT_UP callback for the same button will be generated (assuming the window still has a mouse callback registered) when the mouse button is released even if the mouse has moved outside the window.

If a menu is attached to a button for a window, mouse callbacks will not be generated for that button.

During a mouse callback, glutGetModifiers may be called to determine the state of modifier keys when the mouse event generating the callback occurred.

Passing null to glutMouseFunc disables the generation of mouse callbacks.

public static glutMouseFunc ( [ func ) : void
func [ /// The new mouse callback function. See . ///
Результат void

glutMouseWheelFunc() публичный статический Метод

Sets the mouse wheel callback.
public static glutMouseWheelFunc ( [ func ) : void
func [ /// The new mouse wheel callback function. See . ///
Результат void

glutOverlayDisplayFunc() публичный статический Метод

Sets the overlay display callback for the current window.

glutDisplayFunc sets the overlay display callback for the current window. The overlay display callback is functionally the same as the window's display callback except that the overlay display callback is used to redisplay the window's overlay.

When GLUT determines that the overlay display for the window needs to be redisplayed, the overlay display callback for the window is called. Before the callback, the current window is set to the window needing to be redisplayed and the layer in use is set to the overlay. The overlay display callback is called with no parameters. The entire overlay region should be redisplayed in response to the callback (this includes ancillary buffers if your program depends on their state).

GLUT determines when the overlay display callback should be triggered based on the window's overlay redisplay state. The overlay redisplay state for a window can be either set explicitly by calling glutPostOverlayRedisplay or implicitly as the result of window damage reported by the window system. Multiple posted overlay redisplays for a window are coalesced by GLUT to minimize the number of overlay display callbacks called.

Upon return from the overlay display callback, the overlay damaged state of the window (returned by calling Glut.glutLayerGet(Glut.GLUT_OVERLAY_DAMAMGED) is cleared.

The overlay display callback can be deregistered by passing null to glutOverlayDisplayFunc. The overlay display callback is initially null when an overlay is established. See glutDisplayFunc to understand how the display callback alone is used if an overlay display callback is not registered.

public static glutOverlayDisplayFunc ( [ func ) : void
func [ /// The new overlay display callback function. See /// . ///
Результат void

glutPassiveMotionFunc() публичный статический Метод

Sets the passive motion callbacks for the current window.

glutPassiveMotionFunc sets the passive motion callback for the current window. The passive motion callback for a window is called when the mouse moves within the window while no mouse buttons are pressed.

The x and y callback parameters indicate the mouse location in window relative coordinates.

Passing null to glutPassiveMotionFunc disables the generation of the passive motion callback.

public static glutPassiveMotionFunc ( [ func ) : void
func [ /// The new passive motion callback function. See /// . ///
Результат void

glutReshapeFunc() публичный статический Метод

Sets the reshape callback for the current window.

glutReshapeFunc sets the reshape callback for the current window. The reshape callback is triggered when a window is reshaped. A reshape callback is also triggered immediately before a window's first display callback after a window is created or whenever an overlay for the window is established. The width and height parameters of the callback specify the new window size in pixels. Before the callback, the current window is set to the window that has been reshaped.

If a reshape callback is not registered for a window or null is passed to glutReshapeFunc (to deregister a previously registered callback), the default reshape callback is used. This default callback will simply call Gl.glViewport(0, 0, width, height) on the normal plane (and on the overlay if one exists).

If an overlay is established for the window, a single reshape callback is generated. It is the callback's responsibility to update both the normal plane and overlay for the window (changing the layer in use as necessary).

When a top-level window is reshaped, subwindows are not reshaped. It is up to the GLUT program to manage the size and positions of subwindows within a top-level window. Still, reshape callbacks will be triggered for subwindows when their size is changed using glutReshapeWindow.

public static glutReshapeFunc ( [ func ) : void
func [ /// The new reshape callback function. See . ///
Результат void

glutSpaceballButtonFunc() публичный статический Метод

Sets the Spaceball button callback for the current window.

glutSpaceballButtonFunc sets the Spaceball button callback for the current window. The Spaceball button callback for a window is called when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball button presses. The button parameter will be the button number (starting at one). The number of available Spaceball buttons can be determined with glutDeviceGet(GLUT_NUM_SPACEBALL_BUTTONS). The state is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively.

Registering a Spaceball button callback when a Spaceball device is not available is ineffectual and not an error. In this case, no Spaceball button callbacks will be generated.

Passing null to glutSpaceballButtonFunc disables the generation of Spaceball button callbacks. When a new window is created, no Spaceball button callback is initially registered.

public static glutSpaceballButtonFunc ( [ func ) : void
func [ /// The new Spaceball button callback function. See /// . ///
Результат void

glutSpaceballMotionFunc() публичный статический Метод

Sets the Spaceball motion callback for the current window.

glutSpaceballMotionFunc sets the Spaceball motion callback for the current window. The Spaceball motion callback for a window is called when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball translations. The x, y, and z callback parameters indicate the translations along the X, Y, and Z axes. The callback parameters are normalized to be within the range of -1000 to 1000 inclusive.

Registering a Spaceball motion callback when a Spaceball device is not available has no effect and is not an error. In this case, no Spaceball motion callbacks will be generated.

Passing null to glutSpaceballMotionFunc disables the generation of Spaceball motion callbacks. When a new window is created, no Spaceball motion callback is initially registered.

public static glutSpaceballMotionFunc ( [ func ) : void
func [ /// The new Spaceball motion callback function. See /// . ///
Результат void

glutSpaceballRotateFunc() публичный статический Метод

Sets the Spaceball rotation callback for the current window.

glutSpaceballRotateFunc sets the Spaceball rotate callback for the current window. The Spaceball rotate callback for a window is called when the window has Spaceball input focus (normally, when the mouse is in the window) and the user generates Spaceball rotations. The x, y, and z callback parameters indicate the rotation along the X, Y, and Z axes. The callback parameters are normalized to be within the range of -1800 to 1800 inclusive.

Registering a Spaceball rotate callback when a Spaceball device is not available is ineffectual and not an error. In this case, no Spaceball rotate callbacks will be generated.

Passing null to glutSpaceballRotateFunc disables the generation of Spaceball rotate callbacks. When a new window is created, no Spaceball rotate callback is initially registered.

public static glutSpaceballRotateFunc ( [ func ) : void
func [ /// The new Spaceball rotate callback function. See /// . ///
Результат void

glutSpecialFunc() публичный статический Метод

Sets the special keyboard callback for the current window.

glutSpecialFunc sets the special keyboard callback for the current window. The special keyboard callback is triggered when keyboard function or directional keys are pressed. The key callback parameter is a GLUT_KEY_* constant for the special key pressed. The x and y callback parameters indicate the mouse in window relative coordinates when the key was pressed. When a new window is created, no special callback is initially registered and special key strokes in the window are ignored. Passing null to glutSpecialFunc disables the generation of special callbacks.

During a special callback, glutGetModifiers may be called to determine the state of modifier keys when the keystroke generating the callback occurred.

An implementation should do its best to provide ways to generate all the GLUT_KEY_* special keys. The available GLUT_KEY_* values are:

Value Description GLUT_KEY_F1 F1 function key. GLUT_KEY_F2 F2 function key. GLUT_KEY_F3 F3 function key. GLUT_KEY_F4 F4 function key. GLUT_KEY_F5 F5 function key. GLUT_KEY_F6 F6 function key. GLUT_KEY_F7 F7 function key. GLUT_KEY_F8 F8 function key. GLUT_KEY_F9 F9 function key. GLUT_KEY_F10 F10 function key. GLUT_KEY_F11 F11 function key. GLUT_KEY_F12 F12 function key. GLUT_KEY_LEFT Left directional key. GLUT_KEY_UP Up directional key. GLUT_KEY_RIGHT Right directional key. GLUT_KEY_DOWN Down directional key. GLUT_KEY_PAGE_UP Page up directional key. GLUT_KEY_PAGE_DOWN Page down directional key. GLUT_KEY_HOME Home directional key. GLUT_KEY_END End directional key. GLUT_KEY_INSERT Insert directional key.

Note that the escape, backspace, and delete keys are generated as an ASCII character.

public static glutSpecialFunc ( [ func ) : void
func [ /// The new special callback function. See . ///
Результат void

glutSpecialUpFunc() публичный статический Метод

Sets the special keyboard up (key release) callback for the current window.

glutSpecialUpFunc sets the special keyboard up (key release) callback for the current window. The special keyboard up callback is triggered when keyboard function or directional keys are released. The key callback parameter is a GLUT_KEY_* constant for the special key pressed. The x and y callback parameters indicate the mouse in window relative coordinates when the key was pressed. When a new window is created, no special up callback is initially registered and special key releases in the window are ignored. Passing null to glutSpecialUpFunc disables the generation of special up callbacks.

During a special up callback, glutGetModifiers may be called to determine the state of modifier keys when the key release generating the callback occurred.

To avoid the reporting of key release/press pairs due to auto repeat, use glutIgnoreKeyRepeat to ignore auto repeated keystrokes.

An implementation should do its best to provide ways to generate all the GLUT_KEY_* special keys. The available GLUT_KEY_* values are:

Value Description GLUT_KEY_F1 F1 function key. GLUT_KEY_F2 F2 function key. GLUT_KEY_F3 F3 function key. GLUT_KEY_F4 F4 function key. GLUT_KEY_F5 F5 function key. GLUT_KEY_F6 F6 function key. GLUT_KEY_F7 F7 function key. GLUT_KEY_F8 F8 function key. GLUT_KEY_F9 F9 function key. GLUT_KEY_F10 F10 function key. GLUT_KEY_F11 F11 function key. GLUT_KEY_F12 F12 function key. GLUT_KEY_LEFT Left directional key. GLUT_KEY_UP Up directional key. GLUT_KEY_RIGHT Right directional key. GLUT_KEY_DOWN Down directional key. GLUT_KEY_PAGE_UP Page up directional key. GLUT_KEY_PAGE_DOWN Page down directional key. GLUT_KEY_HOME Home directional key. GLUT_KEY_END End directional key. GLUT_KEY_INSERT Insert directional key.

Note that the escape, backspace, and delete keys are generated as an ASCII character.

public static glutSpecialUpFunc ( [ func ) : void
func [ /// The new special keyboard up callback function. /// . ///
Результат void

glutTabletButtonFunc() публичный статический Метод

Sets the tablet button callback for the current window.

glutTabletButtonFunc sets the tablet button callback for the current window. The tablet button callback for a window is called when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet button presses. The button parameter will be the button number (starting at one). The number of available tablet buttons can be determined with Glut.glutDeviceGet(Glut.GLUT_NUM_TABLET_BUTTONS). The state is either GLUT_UP or GLUT_DOWN indicating whether the callback was due to a release or press respectively. The x and y callback parameters indicate the window relative coordinates when the tablet button state changed.

Registering a tablet button callback when a tablet device is not available is ineffectual and not an error. In this case, no tablet button callbacks will be generated.

Passing null to glutTabletButtonFunc disables the generation of tablet button callbacks. When a new window is created, no tablet button callback is initially registered.

public static glutTabletButtonFunc ( [ func ) : void
func [ /// The new tablet button callback function. See /// . ///
Результат void

glutTabletMotionFunc() публичный статический Метод

Sets the tablet motion callback for the current window.

glutTabletMotionFunc sets the tablet motion callback for the current window. The tablet motion callback for a window is called when the window has tablet input focus (normally, when the mouse is in the window) and the user generates tablet motion. The x and y callback parameters indicate the absolute position of the tablet "puck" on the tablet. The callback parameters are normalized to be within the range of 0 to 2000 inclusive.

Registering a tablet motion callback when a tablet device is not available is ineffectual and not an error. In this case, no tablet motion callbacks will be generated.

Passing null to glutTabletMotionFunc disables the generation of tablet motion callbacks. When a new window is created, no tablet motion callback is initially registered.

public static glutTabletMotionFunc ( [ func ) : void
func [ /// The new tablet motion callback function. See /// . ///
Результат void

glutTimerFunc() публичный статический Метод

Registers a timer callback to be triggered in a specified number of milliseconds.

glutTimerFunc registers the timer callback func to be triggered in at least msecs milliseconds. The val parameter to the timer callback will be the value of the val parameter to glutTimerFunc. Multiple timer callbacks at same or differing times may be registered simultaneously.

The number of milliseconds is a lower bound on the time before the callback is generated. GLUT attempts to deliver the timer callback as soon as possible after the expiration of the callback's time interval.

There is no support for canceling a registered callback. Instead, ignore a callback based on its val parameter when it is triggered.

public static glutTimerFunc ( int msecs, [ func, int val ) : void
msecs int /// The number of milliseconds between calls to the timer callback. ///
func [ /// The new timer callback function. See . ///
val int /// The value to be passed to the timer callback. ///
Результат void

glutVisibilityFunc() публичный статический Метод

Sets the visibility callback for the current window.

glutVisibilityFunc sets the visibility callback for the current window. The visibility callback for a window is called when the visibility of a window changes. The state callback parameter is either GLUT_NOT_VISIBLE or GLUT_VISIBLE depending on the current visibility of the window. GLUT_VISIBLE does not distinguish a window being totally versus partially visible. GLUT_NOT_VISIBLE means no part of the window is visible, i.e., until the window's visibility changes, all further rendering to the window is discarded.

GLUT considers a window visible if any pixel of the window is visible or any pixel of any descendant window is visible on the screen.

Passing null to glutVisibilityFunc disables the generation of the visibility callback.

If the visibility callback for a window is disabled and later re-enabled, the visibility status of the window is undefined; any change in window visibility will be reported, that is if you disable a visibility callback and re-enable the callback, you are guaranteed the next visibility change will be reported.

public static glutVisibilityFunc ( [ func ) : void
func [ /// The new visibility callback function. See . ///
Результат void

glutWMCloseFunc() публичный статический Метод

Sets the window close callback for the current window.
public static glutWMCloseFunc ( [ func ) : void
func [ /// The new window close callback function. See . ///
Результат void

glutWindowStatusFunc() публичный статический Метод

Sets the window status callback for the current window.

glutWindowStatusFunc sets the window status callback for the current window. The window status callback for a window is called when the window status (visibility) of a window changes. The state callback parameter is one of GLUT_HIDDEN, GLUT_FULLY_RETAINED, GLUT_PARTIALLY_RETAINED, or GLUT_FULLY_COVERED depending on the current window status of the window. GLUT_HIDDEN means that the window is either not shown (often meaning that the window is iconified). GLUT_FULLY_RETAINED means that the window is fully retained (no pixels belonging to the window are covered by other windows). GLUT_PARTIALLY_RETAINED means that the window is partially retained (some but not all pixels belonging to the window are covered by other windows). GLUT_FULLY_COVERED means the window is shown but no part of the window is visible, i.e., until the window's status changes, all further rendering to the window is discarded.

GLUT considers a window visible if any pixel of the window is visible or any pixel of any descendant window is visible on the screen.

GLUT applications are encouraged to disable rendering and/or animation when windows have a status of either GLUT_HIDDEN or GLUT_FULLY_COVERED.

Passing null to glutWindowStatusFunc disables the generation of the window status callback.

If the window status callback for a window is disabled and later re-enabled, the window status of the window is undefined; any change in window window status will be reported, that is if you disable a window status callback and re-enable the callback, you are guaranteed the next window status change will be reported.

Setting the window status callback for a window disables the visibility callback set for the window (and vice versa). The visibility callback is set with glutVisibilityFunc. glutVisibilityFunc is deprecated in favor of the more informative glutWindowStatusFunc.

public static glutWindowStatusFunc ( [ func ) : void
func [ /// The new window status callback function. See /// . ///
Результат void

Описание свойств

GLUT_BITMAP_8_BY_13 публичное статическое свойство

A fixed width font with every character fitting in an 8 by 13 pixel rectangle.
public static IntPtr,System GLUT_BITMAP_8_BY_13
Результат System.IntPtr

GLUT_BITMAP_9_BY_15 публичное статическое свойство

A fixed width font with every character fitting in an 9 by 15 pixel rectangle.
public static IntPtr,System GLUT_BITMAP_9_BY_15
Результат System.IntPtr

GLUT_BITMAP_HELVETICA_10 публичное статическое свойство

A 10-point proportional spaced Helvetica font.
public static IntPtr,System GLUT_BITMAP_HELVETICA_10
Результат System.IntPtr

GLUT_BITMAP_HELVETICA_12 публичное статическое свойство

A 12-point proportional spaced Helvetica font.
public static IntPtr,System GLUT_BITMAP_HELVETICA_12
Результат System.IntPtr

GLUT_BITMAP_HELVETICA_18 публичное статическое свойство

A 18-point proportional spaced Helvetica font.
public static IntPtr,System GLUT_BITMAP_HELVETICA_18
Результат System.IntPtr

GLUT_BITMAP_TIMES_ROMAN_10 публичное статическое свойство

A 10-point proportional spaced Times Roman font.
public static IntPtr,System GLUT_BITMAP_TIMES_ROMAN_10
Результат System.IntPtr

GLUT_BITMAP_TIMES_ROMAN_24 публичное статическое свойство

A 24-point proportional spaced Times Roman font.
public static IntPtr,System GLUT_BITMAP_TIMES_ROMAN_24
Результат System.IntPtr

GLUT_STROKE_MONO_ROMAN публичное статическое свойство

A mono-spaced spaced Roman Simplex font (same characters as GLUT_STROKE_ROMAN) for ASCII characters 32 through 127. The maximum top character in the font is 119.05 units; the bottom descends 33.33 units. Each character is 104.76 units wide.
public static IntPtr GLUT_STROKE_MONO_ROMAN
Результат IntPtr

GLUT_STROKE_ROMAN публичное статическое свойство

A proportionally spaced Roman Simplex font for ASCII characters 32 through 127. The maximum top character in the font is 119.05 units; the bottom descends 33.33 units.
public static IntPtr GLUT_STROKE_ROMAN
Результат IntPtr