Aviatrix3D 1.0

org.j3d.aviatrix3d
Interface DrawableSurface

All Known Implementing Classes:
DebugAWTSurface, ElumensAWTSurface, SimpleAWTSurface, StereoAWTSurface

public interface DrawableSurface

Interface representing the output of a render pipeline.

The output may be any of the traditional types: pBuffer, screen or memory or any non-traditional type like haptic devices, network streams etc.

Version:
$Revision: 1.17 $
Author:
Justin Couch

Field Summary
static int ALTERNATE_FRAME_STEREO
          The stereo rendering type draws to alternate eyes on each frame.
static int NO_STEREO
          The surface will render only non-stereo projection (traditional monoscopic projection policy).
static int QUAD_BUFFER_STEREO
          The stereo rendering type to be used should use quad buffered, alternate frame rendering.
static int TWO_CANVAS_STEREO
          The stereo rendering uses two canvases - one for each eye.
 
Method Summary
 void dispose()
          Instruct this surface that you have finished with the resources needed and to dispose all rendering resources.
 void draw()
          Instruct the surface to draw the collected set of nodes now.
 void getCenterEyeInSurface(javax.vecmath.Point3f position)
          Get the Center Eye position in surface coordinates.
 void getPixelLocationInSurface(float x, float y, javax.vecmath.Point3f position)
          Convert a pixel location to surface coordinates.
 float getStereoEyeSeparation()
          Get the current eye separation value, defined as the distance from the center axis to one eye.
 int getStereoRenderingPolicy()
          Get the current stereo rendering policy in use.
 java.lang.Object getSurfaceObject()
          Get the underlying object that this surface is rendered to.
 void getSurfaceToVWorld(javax.vecmath.Matrix4f matrix)
          Get the surface to VWorld transformation matrix.
 boolean isQuadStereoAvailable()
          Check to see whether this surface supports Quad buffer stereo rendering.
 boolean isStereoAvailable()
          Check to see whether this surface supports stereo rendering.
 void queueDeletedObject(DeletableSceneGraphObject obj)
          An object has been detected as being deleted (no internal or external references to it left) and it needs to be cleaned up.
 void queueShaderRequests(ShaderSceneGraphObject[] initList, int numInit, ShaderSceneGraphObject[] logList, int numLog)
          Queue up a collection of shader objects for processing on the next frame.
 void setClearColor(float r, float g, float b, float a)
          Set the background colour that this surface should be cleared to before the drawing step.
 void setDrawableObjects(RenderInstructions[] commands, int numValid)
          Update the list of items to be rendered to the current list.
 void setRenderControlThread(java.lang.Thread th)
          Tell the surface to use the given thread as the rendering control thread.
 void setStereoEyeSeparation(float sep)
          Set the eye separation value when rendering stereo, defined as the distance from the center axis to one eye.
 void setStereoRenderingPolicy(int policy)
          Set the rendering policy used when handling stereo.
 void swap()
          Swap the buffers now if the surface supports multiple buffer drawing.
 

Field Detail

NO_STEREO

public static final int NO_STEREO
The surface will render only non-stereo projection (traditional monoscopic projection policy).

See Also:
Constant Field Values

QUAD_BUFFER_STEREO

public static final int QUAD_BUFFER_STEREO
The stereo rendering type to be used should use quad buffered, alternate frame rendering. In this type it renders to the left back buffer, then right back buffer and then swaps both. This is useful if you have HMDs which have two separate windows for the rendering.

See Also:
Constant Field Values

ALTERNATE_FRAME_STEREO

public static final int ALTERNATE_FRAME_STEREO
The stereo rendering type draws to alternate eyes on each frame. Used if you have shutter glasses where the user's vision is restricted to one eye or the other, but not both at the same time. Only uses a single double buffer to render alternate eye points

See Also:
Constant Field Values

TWO_CANVAS_STEREO

public static final int TWO_CANVAS_STEREO
The stereo rendering uses two canvases - one for each eye. The canvases are placed either side by side or vertically stacked, depending on the rendering options requested.

See Also:
Constant Field Values
Method Detail

isStereoAvailable

public boolean isStereoAvailable()
Check to see whether this surface supports stereo rendering. As this is not known until after initialisation, this method will return false until it can determine whether or not stereo is available.

Returns:
true Stereo support is currently available

isQuadStereoAvailable

public boolean isQuadStereoAvailable()
Check to see whether this surface supports Quad buffer stereo rendering. Quadbuffers uses the GL_BACK_LEFT and GL_BACK_RIGHT for rendering pairs rather than drawing alternate frames to the same window.

As this is not known until after initialisation, this method will return false until it can determine whether or not stereo is available.

Returns:
true Stereo support is currently available

setStereoRenderingPolicy

public void setStereoRenderingPolicy(int policy)
Set the rendering policy used when handling stereo. The policy must be one of the _STEREO constants defined in this interface.

Parameters:
policy - The policy to currently use
Throws:
java.lang.IllegalArgumentException - The policy type is not one of the legal selections.

getStereoRenderingPolicy

public int getStereoRenderingPolicy()
Get the current stereo rendering policy in use. If not explicitly set by the user, then it will default to NO_STEREO.

Returns:
One of the *_STEREO values

setStereoEyeSeparation

public void setStereoEyeSeparation(float sep)
Set the eye separation value when rendering stereo, defined as the distance from the center axis to one eye. The default value is 0.33 for most applications. The absolute value of the separation is always used.

Parameters:
sep - The amount of eye separation

getStereoEyeSeparation

public float getStereoEyeSeparation()
Get the current eye separation value, defined as the distance from the center axis to one eye. If we are in no-stereo mode then this will return zero.

Returns:
sep The amount of eye separation

setRenderControlThread

public void setRenderControlThread(java.lang.Thread th)
Tell the surface to use the given thread as the rendering control thread. Used when you want to clock the renderer to the rest of the pipeline, rather than letting it sit in it's own loop. Due to bugs in JOGL, we have to start the internal rendering threads after the containing window has become visible. See JOGL issue #54 for more details on this bug.

Parameters:
th - The render control thread instance to use or null

setClearColor

public void setClearColor(float r,
                          float g,
                          float b,
                          float a)
Set the background colour that this surface should be cleared to before the drawing step. Colours range from 0 to 1 in the normal manner.

Parameters:
r - The red component of the background clear colour
g - The green component of the background clear colour
b - The blue component of the background clear colour
a - The alpha component of the background clear colour

queueDeletedObject

public void queueDeletedObject(DeletableSceneGraphObject obj)
An object has been detected as being deleted (no internal or external references to it left) and it needs to be cleaned up. The next oppourtunity this drawable and any sub-drawables get, this object should have it's cleanup() method called and then the reference to it should be discarded.

Parameters:
obj - The instance to be queued for deletion

queueShaderRequests

public void queueShaderRequests(ShaderSceneGraphObject[] initList,
                                int numInit,
                                ShaderSceneGraphObject[] logList,
                                int numLog)
Queue up a collection of shader objects for processing on the next frame. These processing requests are for either initialisation or log handling, not for rendering.

Parameters:
initList - The shaders needing initialisation
numInit - The number of shaders needing initialisation
logList - The shaders needing log fetching
numLog - The number of shaders needing log fetching

setDrawableObjects

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

Parameters:
commands - The list of drawable surfaces to render
numValid - The number of valid items in the array

draw

public void draw()
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.


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.


getSurfaceObject

public java.lang.Object getSurfaceObject()
Get the underlying object that this surface is rendered to. If it is a screen display device, the surface can be one of AWT Component or Swing JComponent. An off-screen buffer would be a form of AWT Image etc.

Returns:
The drawable surface representation

dispose

public void dispose()
Instruct this surface that you have finished with the resources needed and to dispose all rendering resources.


getSurfaceToVWorld

public void getSurfaceToVWorld(javax.vecmath.Matrix4f matrix)
Get the surface to VWorld transformation matrix.

Parameters:
matrix - The matrix to copy into

getPixelLocationInSurface

public void getPixelLocationInSurface(float x,
                                      float y,
                                      javax.vecmath.Point3f position)
Convert a pixel location to surface coordinates.

Parameters:
x - The X coordinate
y - The Y coordinate
position - The converted position. It must be preallocated.

getCenterEyeInSurface

public void getCenterEyeInSurface(javax.vecmath.Point3f position)
Get the Center Eye position in surface coordinates.

Parameters:
position - The current eye position. It must be preallocated.

Aviatrix3D 1.0

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