j3d.org Aviatrix3D

org.j3d.aviatrix3d.surface
Class SimpleAWTSurface

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

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

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

Constructor Summary
SimpleAWTSurface(net.java.games.jogl.GLCapabilities caps)
          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.
 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.
 void reshape(net.java.games.jogl.GLDrawable drawable, int x, int y, int width, int height)
          Not used in this implementation
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAWTSurface

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

Parameters:
caps - A set of required capabilities for this canvas.
Method Detail

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.

Specified by:
setTextureDeletionQueue in interface DrawableSurface
Parameters:
queue - The instance of the queue 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.

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

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

j3d.org Aviatrix3D

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