Aviatrix3D 1.0

org.j3d.aviatrix3d.surface
Class ElumensAWTSurface

java.lang.Object
  extended byorg.j3d.aviatrix3d.surface.ElumensAWTSurface
All Implemented Interfaces:
DrawableSurface, java.util.EventListener, net.java.games.jogl.GLEventListener

public class ElumensAWTSurface
extends java.lang.Object
implements DrawableSurface, net.java.games.jogl.GLEventListener

A surface which uses the Elumens SPI library to output to curved surfaces.

This implementation is capable of handling multichannel dome support with configurable number of channels. The number of channels used can be modified on the fly, but it is costly to do so as the render has to be reinitialized each time.

Currently stereo is not supported on this device, though it may be at a future time.

Version:
$Revision: 1.17 $
Author:
Alan Hudson

Field Summary
 
Fields inherited from interface org.j3d.aviatrix3d.DrawableSurface
ALTERNATE_FRAME_STEREO, NO_STEREO, QUAD_BUFFER_STEREO, TWO_CANVAS_STEREO
 
Constructor Summary
ElumensAWTSurface(net.java.games.jogl.GLCapabilities caps, int channels)
          Construct a surface that requires the given set of capabilities.
 
Method Summary
 void checkForExtension(java.lang.String glExtensionString)
          Add an extension string to check for at startup.
 void display(net.java.games.jogl.GLDrawable drawable)
          Not used in this implementation
 void displayChanged(net.java.games.jogl.GLDrawable drawable, boolean modeChanged, boolean deviceChanged)
          Not used in this implementation
 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 - always returns 0.
 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.
 void init(net.java.games.jogl.GLDrawable drawable)
          Called by the drawable immediately after the OpenGL context is initialized; the GLContext has already been made current when this method is called.
 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 reshape(net.java.games.jogl.GLDrawable drawable, int x, int y, int width, int height)
          Not used in this implementation
 void setChanEyePosition(int wall, float x, float y, float z)
          Set the channel eye position.
 void setChanLensPosition(int wall, float x, float y, float z)
          Set the channel lens position.
 void setChanSize(int wall, int height, int width)
          Set the channel size.
 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 setNumberOfChannels(int channels)
          Set the number of channels to display.
 void setRenderControlThread(java.lang.Thread th)
          Tell the surface to use the given thread as the rendering control thread.
 void setScreenOrientation(double r, double p, double v)
          Set the screen orientation.
 void setStereoEyeSeparation(float sep)
          Set the eye separation value when rendering stereo.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElumensAWTSurface

public ElumensAWTSurface(net.java.games.jogl.GLCapabilities caps,
                         int channels)
Construct a surface that requires the given set of capabilities.

Parameters:
caps - A set of required capabilities for this canvas.
channels - The number of channels to render.
Method Detail

setNumberOfChannels

public void setNumberOfChannels(int channels)
Set the number of channels to display. Calling this will cause a reinitialization of renderer.

Parameters:
channels - The number of channels to render.

setChanLensPosition

public void setChanLensPosition(int wall,
                                float x,
                                float y,
                                float z)
Set the channel lens position.

Parameters:
wall - The walls to affect. Defined in org.j3d.device.output.elumens.SPI
x - The x position
y - The y position
z - The z position

setChanEyePosition

public void setChanEyePosition(int wall,
                               float x,
                               float y,
                               float z)
Set the channel eye position.

Parameters:
wall - The walls to affect. Defined in org.j3d.device.output.elumens.SPI
x - The x position
y - The y position
z - The z position

setScreenOrientation

public void setScreenOrientation(double r,
                                 double p,
                                 double v)
Set the screen orientation. Allows the project to rotated in software for different hardware setups.

Parameters:
r - The roll
p - The pitch
v - The yaw

setChanSize

public void setChanSize(int wall,
                        int height,
                        int width)
Set the channel size.

Parameters:
wall - The walls to affect. Defined in org.j3d.device.output.elumens.SPI
height - The height in pixels
width - The width in pixels

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.

Specified by:
isStereoAvailable in interface DrawableSurface
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.

Specified by:
isQuadStereoAvailable in interface DrawableSurface
Returns:
true Stereo support is currently available

setStereoEyeSeparation

public void setStereoEyeSeparation(float sep)
Set the eye separation value when rendering stereo. The default value is 0.33 for most applications. The absolute value of the separation is always used. Ignored for this implementation.

Specified by:
setStereoEyeSeparation in interface DrawableSurface
Parameters:
sep - The amount of eye separation

getStereoEyeSeparation

public float getStereoEyeSeparation()
Get the current eye separation value - always returns 0.

Specified by:
getStereoEyeSeparation in interface DrawableSurface
Returns:
sep The amount of eye separation

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.

Specified by:
setStereoRenderingPolicy in interface DrawableSurface
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.

Specified by:
getStereoRenderingPolicy in interface DrawableSurface
Returns:
One of the *_STEREO values

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.

Specified by:
queueDeletedObject in interface DrawableSurface
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.

Specified by:
queueShaderRequests in interface DrawableSurface
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

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.

Specified by:
setClearColor in interface DrawableSurface
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

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.

Specified by:
setDrawableObjects in interface DrawableSurface
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.

Specified by:
draw in interface DrawableSurface

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 DrawableSurface

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.

Specified by:
getSurfaceObject in interface DrawableSurface
Returns:
The drawable surface representation

getSurfaceToVWorld

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

Specified by:
getSurfaceToVWorld in interface DrawableSurface
Parameters:
matrix - The matrix instance to copy into

getPixelLocationInSurface

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

Specified by:
getPixelLocationInSurface in interface DrawableSurface
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.

Specified by:
getCenterEyeInSurface in interface DrawableSurface
Parameters:
position - The current eye position. It must be preallocated.

dispose

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

Specified by:
dispose in interface DrawableSurface

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.

Specified by:
setRenderControlThread in interface DrawableSurface
Parameters:
th - The render control thread instance to use or null

init

public void init(net.java.games.jogl.GLDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized; the GLContext has already been made current when this method is called.

Specified by:
init in interface net.java.games.jogl.GLEventListener
Parameters:
drawable - The display context to render to

reshape

public void reshape(net.java.games.jogl.GLDrawable drawable,
                    int x,
                    int y,
                    int width,
                    int height)
Not used in this implementation

Specified by:
reshape in interface net.java.games.jogl.GLEventListener
Parameters:
drawable - The display context to render to

displayChanged

public void displayChanged(net.java.games.jogl.GLDrawable drawable,
                           boolean modeChanged,
                           boolean deviceChanged)
Not used in this implementation

Specified by:
displayChanged in interface net.java.games.jogl.GLEventListener
Parameters:
drawable - The display context to render to

display

public void display(net.java.games.jogl.GLDrawable drawable)
Not used in this implementation

Specified by:
display in interface net.java.games.jogl.GLEventListener
Parameters:
drawable - The display context to render to

checkForExtension

public void checkForExtension(java.lang.String glExtensionString)
Add an extension string to check for at startup.

Parameters:
glExtensionString - String to check for being valid

Aviatrix3D 1.0

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