Aviatrix3D
2.1.0

org.j3d.aviatrix3d.output.graphics
Class BaseAWTSurface

java.lang.Object
  extended by org.j3d.aviatrix3d.output.graphics.BaseSurface
      extended by org.j3d.aviatrix3d.output.graphics.BaseAWTSurface
All Implemented Interfaces:
GraphicsOutputDevice, OutputDevice
Direct Known Subclasses:
DebugAWTSurface, ElumensAWTSurface, SimpleAWTSurface, StereoAWTSurface

public abstract class BaseAWTSurface
extends BaseSurface

Implementation of the most basic drawable surface extended to provide AWT-specific features.

Version:
$Revision: 3.7 $
Author:
Justin Couch

Field Summary
protected  boolean lightweight
          Flag indicating if we're a lightweight surface or not
protected  org.j3d.aviatrix3d.output.graphics.AWTResizeHandler resizer
          Handler for dealing with the AWT to our graphics resize handler
 
Fields inherited from class org.j3d.aviatrix3d.output.graphics.BaseSurface
alphaCutoff, canCreatePBuffers, canvas, canvasContext, canvasDescriptor, canvasRenderer, errorReporter, FAILED_CONTEXT_MSG, initComplete, numRenderables, renderableList, rendererMap, sharedSurface, singleThreaded, surfaceMonitor, terminate, useTwoPassTransparent
 
Fields inherited from interface org.j3d.aviatrix3d.pipeline.graphics.GraphicsOutputDevice
ALTERNATE_FRAME_STEREO, NO_STEREO, QUAD_BUFFER_STEREO, TWO_CANVAS_STEREO
 
Constructor Summary
protected BaseAWTSurface(BaseSurface sharedWith, boolean lightweight)
          Construct a surface shares it's GL context with the given surface.
 
Method Summary
 void addGraphicsResizeListener(GraphicsResizeListener l)
          Add a resize listener instance to this surface.
protected abstract  boolean createLightweightContext()
          Attempt to create a new lightweight canvas renderer now.
 boolean draw(ProfilingData profilingData)
          Instruct the surface to draw the collected set of nodes now.
 void removeGraphicsResizeListener(GraphicsResizeListener l)
          Remove a resize listener from this surface.
 void setDrawableObjects(GraphicsRequestData otherData, GraphicsInstructions[] commands, int numValid)
          Update the list of items to be rendered to the current list.
 void setErrorReporter(org.j3d.util.ErrorReporter reporter)
          Register an error reporter with the engine so that any errors generated by the node's internals can be reported in a nice, pretty fashion.
 void swap()
          Swap the buffers now if the surface supports multiple buffer drawing.
 
Methods inherited from class org.j3d.aviatrix3d.output.graphics.BaseSurface
addSurfaceInfoListener, checkForExtension, completeCanvasInitialisation, createRenderingProcessor, dispose, disposeSingleThreadResources, enableSingleThreaded, enableTwoPassTransparentRendering, getAlphaTestCutoff, getCenterEyeInSurface, getGLContext, getPixelLocationInSurface, getSharedGLContext, getStereoEyeSeparation, getStereoRenderingPolicy, getSurfaceToVWorld, init, initCanvas, isDisposed, isQuadStereoAvailable, isShared, isStereoAvailable, isTwoPassTransparentEnabled, removeSurfaceInfoListener, setAlphaTestCutoff, setClearColor, setColorClearNeeded, setStereoEyeSeparation, setStereoRenderingPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.aviatrix3d.pipeline.OutputDevice
getSurfaceObject
 

Field Detail

resizer

protected org.j3d.aviatrix3d.output.graphics.AWTResizeHandler resizer
Handler for dealing with the AWT to our graphics resize handler


lightweight

protected final boolean lightweight
Flag indicating if we're a lightweight surface or not

Constructor Detail

BaseAWTSurface

protected BaseAWTSurface(BaseSurface sharedWith,
                         boolean lightweight)
Construct a surface shares it's GL context with the given surface. This is useful for constructing multiple view displays of the same scene graph, but from different viewing directions, such as in a CAD application.

If the sharedWith parameter is null, then this is just treated as an ordinary non-shared frame. The return flag will be set appropriately.

Parameters:
sharedWith - The surface that you'd like this surface to share the GL context with, if possible. May be null.
lightweight - If true, uses a GLJPanel (lightweight) JComponent, otherwise a GLCanvas. Note that setting this to true could negatively impact performance.
Method Detail

setErrorReporter

public void setErrorReporter(org.j3d.util.ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated by the node's internals can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.

Specified by:
setErrorReporter in interface OutputDevice
Overrides:
setErrorReporter in class BaseSurface
Parameters:
reporter - The instance to use or null

addGraphicsResizeListener

public void addGraphicsResizeListener(GraphicsResizeListener l)
Add a resize listener instance to this surface. Duplicate listener instance add requests are ignored, as are null values.

Parameters:
l - The new listener instance to add

removeGraphicsResizeListener

public void removeGraphicsResizeListener(GraphicsResizeListener l)
Remove a resize listener from this surface. If the listener is not currently registered the request is ignored.

Parameters:
l - The listener instance to remove

setDrawableObjects

public void setDrawableObjects(GraphicsRequestData otherData,
                               GraphicsInstructions[] commands,
                               int numValid)
Update the list of items to be rendered to the current list. Draw them at the next oppourtunity.

Specified by:
setDrawableObjects in interface GraphicsOutputDevice
Overrides:
setDrawableObjects in class BaseSurface
Parameters:
otherData - data to be processed before the rendering
commands - The list of drawable surfaces to render
numValid - The number of valid items in the array

swap

public void swap()
Swap the buffers now if the surface supports multiple buffer drawing. For surfaces that don't support multiple buffers, this does nothing.

Specified by:
swap in interface GraphicsOutputDevice
Overrides:
swap in class BaseSurface

draw

public boolean draw(ProfilingData profilingData)
Instruct the surface to draw the collected set of nodes now. The registered view environment is used to draw to this surface. If no view is registered, the surface is cleared and then this call is exited. The drawing surface does not swap the buffers at this point.

The return value indicates success or failure in the ability to render this frame. Typically it will indicate failure if the underlying surface has been disposed of, either directly through the calling of the method on this interface, or through an internal check mechanism. If failure is indicated, then check to see if the surface has been disposed of and discontinue rendering if it has.

Specified by:
draw in interface OutputDevice
Overrides:
draw in class BaseSurface
Parameters:
profilingData - The timing and load data
Returns:
true if the drawing succeeded, or false if not

createLightweightContext

protected abstract boolean createLightweightContext()
Attempt to create a new lightweight canvas renderer now. This will only be called whenever the user has signalled that this is a lightweight renderer and we do not yet have a canvasRenderer instance created. If this fails, silently exit. We'll attempt to do this next frame.

Returns:
true if this creation succeeded

Aviatrix3D
2.1.0

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - 2009 j3d.org