Aviatrix3D
2.1.0

org.j3d.renderer.aviatrix3d.swt.output
Class DebugSWTSurface

java.lang.Object
  extended by org.j3d.aviatrix3d.output.graphics.BaseSurface
      extended by org.j3d.renderer.aviatrix3d.swt.output.BaseSWTSurface
          extended by org.j3d.renderer.aviatrix3d.swt.output.DebugSWTSurface
All Implemented Interfaces:
java.util.EventListener, org.eclipse.swt.events.KeyListener, org.eclipse.swt.internal.SWTEventListener, GraphicsOutputDevice, OutputDevice

public class DebugSWTSurface
extends BaseSWTSurface
implements org.eclipse.swt.events.KeyListener

Implementation of the surface using SWT that allows for single-shot debugging output..

To dump a set of GL trace, the 'd' key is mapped to dump the next frame.

Note: The lightweight flag is ignored currently.

Version:
$Revision: 3.10 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.renderer.aviatrix3d.swt.output.BaseSWTSurface
resizer, swtCanvas
 
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
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps)
          Construct a surface that requires the given set of capabilities.
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps, BaseSurface sharedWith)
          Construct a surface shares it's GL context with the given surface.
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps, BaseSurface sharedWith, boolean lightweight)
          Construct a surface shares it's GL context with the given surface.
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps, boolean lightweight)
          Construct a surface that requires the given set of capabilities.
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps, javax.media.opengl.GLCapabilitiesChooser chooser)
          Construct a surface that requires the given set of capabilities.
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps, javax.media.opengl.GLCapabilitiesChooser chooser, BaseSurface sharedWith)
          Construct a surface shares it's GL context with the given surface.
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps, javax.media.opengl.GLCapabilitiesChooser chooser, BaseSurface sharedWith, boolean lightweight)
          Construct a surface shares it's GL context with the given surface.
DebugSWTSurface(org.eclipse.swt.widgets.Composite parent, int style, javax.media.opengl.GLCapabilities caps, javax.media.opengl.GLCapabilitiesChooser chooser, boolean lightweight)
          Construct a surface that requires the given set of capabilities.
 
Method Summary
protected  RenderingProcessor createRenderingProcessor(javax.media.opengl.GLContext context)
          Overridden to provide instances of the debug rendering processor for off screen textures.
 boolean draw(ProfilingData profilingData)
          Instruct the surface to draw the collected set of nodes now.
 void keyPressed(org.eclipse.swt.events.KeyEvent evt)
          Notification of a key press event.
 void keyReleased(org.eclipse.swt.events.KeyEvent evt)
          Notification of a key release event.
 void traceNextFrames(int count)
          For the next count rendered frames, output the GL state to the standard output.
 
Methods inherited from class org.j3d.renderer.aviatrix3d.swt.output.BaseSWTSurface
addGraphicsResizeListener, getSurfaceObject, removeGraphicsResizeListener, setErrorReporter
 
Methods inherited from class org.j3d.aviatrix3d.output.graphics.BaseSurface
addSurfaceInfoListener, checkForExtension, completeCanvasInitialisation, dispose, disposeSingleThreadResources, enableSingleThreaded, enableTwoPassTransparentRendering, getAlphaTestCutoff, getCenterEyeInSurface, getGLContext, getPixelLocationInSurface, getSharedGLContext, getStereoEyeSeparation, getStereoRenderingPolicy, getSurfaceToVWorld, init, initCanvas, isDisposed, isQuadStereoAvailable, isShared, isStereoAvailable, isTwoPassTransparentEnabled, removeSurfaceInfoListener, setAlphaTestCutoff, setClearColor, setColorClearNeeded, setDrawableObjects, setStereoEyeSeparation, setStereoRenderingPolicy, swap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps)
Construct a surface that requires the given set of capabilities. This surface acts as a standalone canvas.

Parameters:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps,
                       javax.media.opengl.GLCapabilitiesChooser chooser)
Construct a surface that requires the given set of capabilities. This surface acts as a standalone canvas.

Parameters:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.
chooser - Custom algorithm for selecting one of the available GLCapabilities for the component;

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps,
                       boolean lightweight)
Construct a surface that requires the given set of capabilities. This surface acts as a standalone canvas.

Parameters:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.
lightweight - If true, uses a GLJPanel (lightweight) JComponent, otherwise a GLCanvas. Note that setting this to true could negatively impact performance.

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps,
                       javax.media.opengl.GLCapabilitiesChooser chooser,
                       boolean lightweight)
Construct a surface that requires the given set of capabilities. This surface acts as a standalone canvas.

Parameters:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.
chooser - Custom algorithm for selecting one of the available GLCapabilities for the component;
lightweight - If true, uses a GLJPanel (lightweight) JComponent, otherwise a GLCanvas. Note that setting this to true could negatively impact performance.

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps,
                       BaseSurface sharedWith)
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:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.
sharedWith - The surface that you'd like this surface to share the GL context with, if possible. May be null.

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps,
                       javax.media.opengl.GLCapabilitiesChooser chooser,
                       BaseSurface sharedWith)
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:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.
chooser - Custom algorithm for selecting one of the available GLCapabilities for the component;
sharedWith - The surface that you'd like this surface to share the GL context with, if possible. May be null.

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps,
                       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:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.
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.

DebugSWTSurface

public DebugSWTSurface(org.eclipse.swt.widgets.Composite parent,
                       int style,
                       javax.media.opengl.GLCapabilities caps,
                       javax.media.opengl.GLCapabilitiesChooser chooser,
                       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:
parent - The parent component that this surface uses for the canvas
style - The SWT style bits to use on the created canvas
caps - A set of required capabilities for this canvas.
chooser - Custom algorithm for selecting one of the available GLCapabilities for the component;
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

keyPressed

public void keyPressed(org.eclipse.swt.events.KeyEvent evt)
Notification of a key press event. When the 'd' key is pressed, dump the next frame to stdout.

Specified by:
keyPressed in interface org.eclipse.swt.events.KeyListener
Parameters:
evt - The key event that caused this method to be called

keyReleased

public void keyReleased(org.eclipse.swt.events.KeyEvent evt)
Notification of a key release event. Does nothing for this implementation.

Specified by:
keyReleased in interface org.eclipse.swt.events.KeyListener
Parameters:
evt - The key event that caused this method to be called

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

createRenderingProcessor

protected RenderingProcessor createRenderingProcessor(javax.media.opengl.GLContext context)
Overridden to provide instances of the debug rendering processor for off screen textures.

Overrides:
createRenderingProcessor in class BaseSurface
Parameters:
context - The GLContext instance to wrap for this processor
Returns:
The rendering processor instance to use

traceNextFrames

public void traceNextFrames(int count)
For the next count rendered frames, output the GL state to the standard output. If it is currently dumping, the number will be reset to this value.

Parameters:
count - The number of frames to output the debug state.

Aviatrix3D
2.1.0

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