OpenGLEAN
OpenGLEAN User Support
Home page | Introduction | Documentation | Files | Examples | Proposals | Authors | Links


OpenGLEAN Development
Summary | CVS | (discussion via home page) | (contact via home page) | (suggestion box) | License | Todo | Bugs

Input State
[OpenGLEAN API Reference]

Collaboration diagram for Input State:


Functions

int glutDeviceGet (GLenum eWhat)
int glutGetModifiers (void)
void glutIgnoreKeyRepeat (int ignore)
void glutSetKeyRepeat (int repeatMode)

Function Documentation

int glutDeviceGet GLenum  eWhat  ) 
 

Allows you to get some device state/option variables.

Parameters:
eWhat Enumerated parameter ID.
Retrieves some system-specific information about attached devices. Supported device queries are:

  • GLUT_HAS_KEYBOARD Return non-zero if there is a keyboard.
  • GLUT_HAS_MOUSE Return non-zero if there is a mouse.
  • GLUT_HAS_SPACEBALL (DEPRECATED) Return non-zero if there is a spaceball.
  • GLUT_HAS_JOYSTICK (DEPRECATED) Checks if a joystick is available.
  • GLUT_OWNS_JOYSTICK (DEPRECATED) Checks if OpenGLEAN can use it.
  • GLUT_JOYSTICK_AXES (DEPRECATED) Return the number of axes for the joystick.
  • GLUT_JOYSTICK_POLL_RATE (DEPRECATED) Return the rate (in GLUT timer ticks?) at which the joystick is polled. Requires a current window to be set.
  • GLUT_NUM_MOUSE_BUTTONS Return the number of buttons that the user's mouse has.
  • GLUT_OWNS_JOYSTICK (DEPRECATED) Return non-zero if OpenGLEAN believes that it has successfully acquired access to the joystick.
  • GLUT_DEVICE_IGNORE_KEY_REPEAT Return non-zero if the current window is set to disable key repeating. (Contrast GLUT_DEVICE_KEY_REPEAT.)
  • GLUT_DEVICE_KEY_REPEAT Returns the key repeat mode, one of: GLUT_KEY_REPEAT_OFF, GLUT_KEY_REPEAT_ON, or GLUT_KEY_REPEAT_DEFAULT. This is apparently independant of your current window's setting. (Contrast GLUT_DEVICE_IGNORE_KEY_REPEAT.)
  • GLUT_HAS_DIAL_AND_BUTTON_BOX (DEPRECATED) Return non-zero if a dials-and-buttons box is present.
  • GLUT_HAS_TABLET (DEPRECATED) Return non-zero if a tablet is present.
  • GLUT_NUM_BUTTON_BOX_BUTTONS (DEPRECATED) Return the number of buttons on a dials-and-buttons box, if any.
  • GLUT_NUM_DIALS (DEPRECATED) Return the number of dials on a dials-and-buttons box, if any.
  • GLUT_NUM_SPACEBALL_BUTTONS (DEPRECATED) Return the number of buttons on a spaceball, if any.
  • GLUT_NUM_TABLET_BUTTONS (DEPRECATED) Return the number of buttons on a tablet, if any.

It is an error---presently fatal---to call this function without first properly initializing OpenGLEAN via glutInit(). If the parameter to glutDeviceGet() is unknown, a return value of -1 is given. It is believed that at present a -1 return value always indicates an error, but that may not be a safe assumption forever.

Note:
freeglut and OpenGLUT confusingly claim that the GLUT_DEVICE_KEY_REPEAT get will return the repeat rate. This is wrong, both with respect to their own implementation and with respect to old GLUT.
See also:
glutSetOption(), glutGet(), glutGetModifiers(), glutLayerGet()
Todo:
Consider moving to a table-based approach rather than a switch(), letting us move to modular functions.
Bug:
Keyboards are optional, but OpenGLEAN doesn't detect their absence.

Mice are optional, but OpenGLEAN is only able to check for them under WIN32.

Mice can have a varying number of buttons, but OpenGLEAN assumes exactly 3 on UNIX_X11.

HAS/OWNS queries on joysticks don't report how many joysticks are there.

BUTTONS/AXES queres on joysticks only work with the first joystick found.

Only supports querying for one joystick.

Here is the call graph for this function:

int glutGetModifiers void   ) 
 

Returns the status of Alt, Shift, and Ctrl keys.

According to which, if any, modifier keys are held, the return value is the logical OR combination of any of the following symbolic bitmasks:.

  • GLUT_ACTIVE_SHIFT
  • GLUT_ACTIVE_CTRL
  • GLUT_ACTIVE_ALT

E.g., if the shift key is held, and no other modifier keys are held, this function will return GLUT_ACTIVE_SHIFT.

It is a fatal error to call this routine without properly initializing OpenGLEAN via glutInit(). It should only be called while servicing an OpenGLEAN input callback (e.g., mouse or key event); if you violate this, a warning will be printed and a 0 mask will be returned. It is probably acceptable to drop the warning. The rationale for only calling withint an input callback is not clear.

Note:
Complains if not invoked by a client callback.

Old GLUT 3.7 describes this as glutCurrentModifiers(), even in the __glutWarning() message if you call it outside of an input callback. However, even GLUT actually defined* this function glutGetModifiers().

This function probably should be replaced with an enumerated constant passed into glutGet(). This would be more consistant with the OpenGL approach, and with, I think, most GLUT-like state retrieval.

Even though there is nothing dangerous about this function if we are not initialized, we do an error-exit if we are not "ready". It is not terribly meaningful to call this function in that case.

See also:
glutSetOption(), glutGet(), glutDeviceGet(), glutLayerGet()
Bug:
Does not differentiate between the left and right forms of the modifiers.

void glutIgnoreKeyRepeat int  ignore  ) 
 

Set autorepeat status.

Parameters:
ignore Whether to ignore autorepeated keys.
If ignore is non-zero, then auto-repeat is disabled for keyboard callbacks for the current window.

It is a fatal error to call this function without first initializing OpenGLEAN via glutInit(), and also it is fatal to call this function without having a current window.

See also:
glutSetKeyRepeat()

void glutSetKeyRepeat int  repeatMode  ) 
 

Sets autorepeat behavior for all OpenGLEAN windows.

Parameters:
repeatMode On, Off or Default.
glutSetKeyRepeat() is similar to glutIgnoreKeyRepeat() but sets the behavior for OpenGLEAN in general, rather than for a particular window. The options for repeatMode are:

  • GLUT_KEY_REPEAT_OFF
    Turn off repeat for all windows.
  • GLUT_KEY_REPEAT_ON
    Turn on repeat for all windows.
  • GLUT_KEY_REPEAT_DEFAULT
    Respect the window's setting.

It is a fatal error to call this function without first initializing OpenGLEAN via glutInit(). It is also fatal to call this function with a repeatMode value that is out of range. The former could possibly be eliminated; the latter should probably be reduced to a warning or inform.

See also:
glutIgnoreKeyRepeat()




SourceForge.net Logo Supported in part by SourceForge.net.

Generated on Fri Sep 16 20:15:34 2005 for OpenGLEAN by doxygen 1.4.3
The OpenGLEAN project is hosted by olib.org and SourceForge.