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

Window Callbacks
[OpenGLEAN API Reference]

Collaboration diagram for Window Callbacks:


Functions

void glutDisplayFunc (void(*callback)(void))
void glutOverlayDisplayFunc (void(*callback)(void))
void glutReshapeFunc (void(*callback)(int w, int h))
void glutWindowStatusFunc (void(*callback)(int state))

Detailed Description

OpenGLEAN's event processing centers around the concept of callbacks. A callback is a function to be invoked by OpenGLEAN when OpenGLEAN processes a suitable event. Many callbacks are associated with windows because most OpenGLEAN events come from user-interaction. If a callback is associated with a window, then you can register different callbacks for different windows, and OpenGLEAN will set the current window to the appropriate window before invoking the callback.

If you do not set a callback, OpenGLEAN will ignore the corresponding event. If you have registered a callback and later wish to restore OpenGLEAN's default behavior, you can set the callback to NULL. Exceptions to these rules are noted on a case-by-case basis.

If an event is not bound to a window, the status of the current window setting is undefined. If such a callback needs to access an OpenGLEAN window, it must first use glutSetWindow() to set the current window. Analogous concerns hold for the current menu.


Function Documentation

void glutDisplayFunc void(*)(void)  callback  ) 
 

Sets the Display callback for the current window.

Parameters:
callback Client function for normal redisplay event.
Sets the display callback for the current window. All windows, including subwindows, must have a display callback registered. OpenGLEAN will call the callback function whenever it thinks that the window may require updating.

This callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Unlike most callbacks, it is illegal to try to disable the display callback by setting it to NULL .

Multiple redisplays may be coalesced into a single event for invoking the callback only once.

See also:
glutPostRedisplay(), glutOverlayDisplayFunc()

void glutOverlayDisplayFunc void(*)(void)  callback  ) 
 

Defines the display hook for an overlay.

Parameters:
callback Client hook for overlay redisplay.
callback is invoked by OpenGLEAN to refresh an overlay, if OpenGLEAN thinks that this is necessary. Generally, very similar to glutDisplayFunc(), save that:

  • The redisplay is triggered differently.
  • OpenGLEAN sets the layer for you.
  • You do not need to have, and can deregister, this callback.

This callback is bound to both the current window and the layer.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

See also:
glutDisplayFunc(), glutPostOverlayRedisplay(), glutEstablishOverlay(), glutUseLayer()
Bug:
OpenGLEAN does not implement layers at this time.

void glutReshapeFunc void(*)(int w, int h)  callback  ) 
 

Sets the Reshape callback for the current window.

Parameters:
callback Client function for reshape-window event.
This registers a function with OpenGLEAN, which OpenGLEAN will invoke whenever the window is reshaped or resized. Your callback is only invoked when the host window system has actually changed the window size.

The parameters to your callback are the new width and height for your window.

If you do not provide a reshape callback, OpenGLEAN will simply call glViewport(0,0,w,h).

This callback is bound to the current window.

To ask OpenGLEAN about the present dimensions of the current window, you can use glutGet().

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

Note:
Unlike other callbacks, GLUT has an active default behavior if you do not set this. (Most event types passively do nothing if you do not specify a callback to handle them.)

The reshape callback should always be called, if registered, when your window is first created.

See also:
glutGet(), glutReshapeWindow()

void glutWindowStatusFunc void(*)(int state)  callback  ) 
 

Sets the window status callback.

Parameters:
callback Client window status hook.
When the visibility status of your window changes, OpenGLEAN either invokes the callback registered by this function or the Visibility callback---or neither, if you have not registered either callback.

This differs from the deprecated glutVisbilityFunc() in that the callback has three states, rather than two, that it may receive. These states are:

  • GLUT_VISIBLE (every pixel visible)
  • GLUT_FULLY_COVERED (every pixel obscured)
  • GLUT_HIDDEN (intermediate)

The callback is bound to the current window.

It is fatal to call this function without properly initializing OpenGLEAN via glutInit(). It is a nonfatal, silent error to call this function without a current window.

See also:
glutPopWindow(), glutPushWindow() glutVisibilityFunc()




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.