j3d.org Aviatrix3D

org.j3d.aviatrix3d
Interface DrawableSurface

All Known Implementing Classes:
ElumensAWTSurface, SimpleAWTSurface

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.10 $
Author:
Justin Couch

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.
 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 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 setTextureDeletionQueue(java.lang.ref.ReferenceQueue queue)
          Set the queue that holds references to the textures that are possibly ready for deletion.
 void swap()
          Swap the buffers now if the surface supports multiple buffer drawing.
 

Method Detail

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

setTextureDeletionQueue

public void setTextureDeletionQueue(java.lang.ref.ReferenceQueue queue)
Set the queue that holds references to the textures that are possibly ready for deletion. Poll this queue once per frame and delete any items found on the queue. A value of null will clear the queue.

Parameters:
queue - The instance of the queue to use or null

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.


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.

j3d.org Aviatrix3D

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