Aviatrix3D
2.1.0

org.j3d.renderer.aviatrix3d.swt.draw2d
Class BaseDraw2DSurface

java.lang.Object
  extended by org.j3d.aviatrix3d.output.graphics.BaseSurface
      extended by org.j3d.renderer.aviatrix3d.swt.draw2d.BaseDraw2DSurface
All Implemented Interfaces:
GraphicsOutputDevice, OutputDevice
Direct Known Subclasses:
DebugDraw2DSurface, SimpleDraw2DSurface

public abstract class BaseDraw2DSurface
extends BaseSurface

Extended base implementation of the basic drawable surface, but adding in some SWT-specific features.

SWT is an independent windowing toolkit developed by IBM as part of the Eclipse project. It doesn't use AWT at all. Note that to run this code we assume that you already have at least SWT installed on your system, and probably even all of Eclipse.

Version:
$Revision: 1.6 $
Author:
Justin Couch

Field Summary
protected  GLFigure glFigure
          The SWT version of the OpenGL canvas
protected  org.j3d.renderer.aviatrix3d.swt.draw2d.FigureResizeHandler 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 BaseDraw2DSurface(BaseSurface sharedWith)
          Construct a surface that requires the given set of capabilities.
 
Method Summary
 void addGraphicsResizeListener(GraphicsResizeListener l)
          Add a resize listener instance to this surface.
 boolean draw(GraphicsProfilingData profilingData)
          Instruct the surface to draw the collected set of nodes now.
 void enableSingleThreaded(boolean state)
          Overrides the base class to prevent any singlethreaded optimisations being performed.
 java.lang.Object getSurfaceObject()
          Get the underlying object that this surface is rendered to.
 void removeGraphicsResizeListener(GraphicsResizeListener l)
          Remove a resize listener from this surface.
 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, draw, enableTwoPassTransparentRendering, getAlphaTestCutoff, getCenterEyeInSurface, getGLContext, getPixelLocationInSurface, getSharedGLContext, getStereoEyeSeparation, getStereoRenderingPolicy, getSurfaceToVWorld, init, initCanvas, isDisposed, isQuadStereoAvailable, isShared, isStereoAvailable, isTwoPassTransparentEnabled, removeSurfaceInfoListener, setAlphaTestCutoff, setClearColor, setColorClearNeeded, setDrawableObjects, setStereoEyeSeparation, setStereoRenderingPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resizer

protected org.j3d.renderer.aviatrix3d.swt.draw2d.FigureResizeHandler resizer
Handler for dealing with the AWT to our graphics resize handler


glFigure

protected GLFigure glFigure
The SWT version of the OpenGL canvas

Constructor Detail

BaseDraw2DSurface

protected BaseDraw2DSurface(BaseSurface sharedWith)
Construct a surface that requires the given set of capabilities. This surface acts as a standalone canvas.

Parameters:
sharedWith - The surface that you'd like this surface to share the GL context with, if possible. May be null.
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

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

enableSingleThreaded

public void enableSingleThreaded(boolean state)
Overrides the base class to prevent any singlethreaded optimisations being performed. This instance is a no-op due to the pbuffer

Specified by:
enableSingleThreaded in interface OutputDevice
Overrides:
enableSingleThreaded in class BaseSurface
Parameters:
state - true if the device can expect single threaded behaviour

getSurfaceObject

public java.lang.Object getSurfaceObject()
Get the underlying object that this surface is rendered to. This method returns a org.j3d.opengl.swt.draw2d.GLFigure object.

Returns:
The drawable surface representation

draw

public boolean draw(GraphicsProfilingData 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.

Parameters:
profilingData - The timing and load data
Returns:
true if the drawing succeeded, or false if not

Aviatrix3D
2.1.0

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