| |
- Background(self, mode=1)
- Customization point for clearing/drawing the background.
The default implementation clears the color and depth
buffers, using solid white for the clear color.
- DoEventCascade(self)
- Customization point for generating non-GUI event cascades
- Lights(self, mode=1)
- Customization point for setting up global illumination parameters
Depending on the mode, should either enable or disable
lighting for all of those lights in the scene.
The default implementation enables lighting and light 0
if render mode is not select, disables them otherwise.
- OnDraw(self, *arguments)
- Basic implementation of a drawing/rendering loop
providing for opaque mode rendering only.
This implementation calls:
Context.setCurrent,
Context.RenderSetup,
Context.Render,
Context.RenderShutdown,
Context.SwapBuffers,
and Context.unsetCurrent
This is a customization point for those creating
rendering loops with, for instance transparency,
special effects and the like.
- OnInit(self)
- Customization point for scene set up and initial processing
You override this method to do housekeeping chores such as
loading images and generating textures, loading pre-established
geometry, spawning new threads, etc.
This method is called after the completion of the Context.__init__
method for the rendering context. GUI implementers:
Wherever possible, this should be the very last function
called in the initialization of the context to allow user
code to use all the functionality of the context.
- OnResize(self, *arguments)
- Resize the window when the windowing library says to
- Render(self, mode=1)
- Customization point for geometry rendering
This method is called by the system to render the
geometry for the system. Wherever possible, you
should pay attention to the rendering modes to allow
for optimization of your geometry (for instance,
selection passes do not require lighting).
The default implementation ensures that matrix mode
is currently model view.
See the module's globals for common rendering mode constants.
- SwapBuffers(self)
- Called by the rendering loop when the buffers should be swapped
Each GUI library needs to override this method with the appropriate
code for the library.
- ViewPort(self, width, height)
- Set the size of the OpenGL rendering viewport for the context
This implementation assumes that the context takes up the entire
underlying window (i.e. that it starts at 0,0 and that width, height
will represent the entire size of the window).
- Viewpoint(self, mode=1)
- Customization point for setting up the projection matrix
The default implementation calls glFrustrum with fairly
generic values to establish a camera similar to a 35mm.
- __init__(self)
- Establish the Context working environment
- addPickEvent(self, event)
- Add an event to the list of events which should be processed
by the selection-render-mode.
- addTransparentObject(self, object)
- Hook for the context to eventually deal with transparent
objects. The context would likely store the projected bounding
box, potentially the model and projection matrix as well. The
presence of the transparent objects would then trigger a transparent
object rendering pass after normal pass, where the objects would
be sorted, then rendered.
- getViewPort(self)
- Method to retrieve the current dimensions of the context
Return value is a width, height tuple. See Context.ViewPort
for setting of this value.
- initializeEventManagers(self, managerClasses=())
- Customisation point for initialising event manager objects
- setCurrent(self)
- Set the OpenGL focus to this context
The default implementation is not thread-aware!
This method should be overridden in any threading
environment, and should there be atomic and require
the acquisition of a threading lock.
- setupCallbacks(self)
- Establishes GUI callbacks for asynchronous event GUI systems
Subclasses and applications will register events
here for those event types in which they are interested.
Most minor applications should use interactivecontext's
abstract callbacks (which translate the GUI library's
native events into a common event framework for all
interactivecontexts).
The default implementation does nothing.
- setupDefaultEventCallbacks(self)
- Used to setup the common callbacks for the context
- shouldRedraw(self)
- Return whether or not the context contents need to be redrawn
- suppressRedraw(self)
- Indicate to the context that there is no need to re-render
This method signals to the context that there are no updates
currently requiring redrawing of the context's contents.
See:
Context.shouldRedraw and Context.triggerRedraw
- triggerPick(self)
- Trigger a selection rendering pass for the given (x,y) point
If the context is not currently drawing, the selection render will
occur immediately, otherwise it will occur the next time the
rendering loop reaches the selection stage.
- triggerRedraw(self, force=0)
- Indicate to the context that it should redraw when possible
If force is true, the rendering will begin immediately if the
context is not already drawing. Otherwise only the indicator flag
will be set.
- unProject(self, x, y, z)
- Take x,y,z as integers and do an unproject to get the model-space x,y,z
- unsetCurrent(self)
- Give up the OpenGL focus from this context
The default implementation is not thread-aware!
This method should be overridden in any threading
environment, and should there be atomic and require
the acquisition of a threading lock.
|