net.jinx.video
Class SplitScreenRenderer

java.lang.Object
  extended by net.jinx.video.SplitScreenRenderer
All Implemented Interfaces:
java.util.EventListener, javax.media.opengl.GLEventListener

public class SplitScreenRenderer
extends java.lang.Object
implements javax.media.opengl.GLEventListener

GLEventListener implementation that allows multiple views to be used, by splitting the screen into equal portions. Instances of the View interface are used for the contents of each segment of the window.

API Stability: Stable, except for setPasses(Pass[]), which is Alpha.


Constructor Summary
SplitScreenRenderer(Visible drawable, View[] views, Context options)
          Constructs a Renderer to render a Visible to the screen.
SplitScreenRenderer(Visible drawable, View view, Context options)
          Utility constructor so you don't have to put a single View in an array.
 
Method Summary
 void display(javax.media.opengl.GLAutoDrawable glDrawable)
          Renders a frame to glDrawable.
 void displayChanged(javax.media.opengl.GLAutoDrawable gLDrawable, boolean modeChanged, boolean deviceChanged)
          Required for the GLEventListener interface.
 void init(javax.media.opengl.GLAutoDrawable glDrawable)
          Initializes the GLDrawable with the parts that are common to each frame.
 void reshape(javax.media.opengl.GLAutoDrawable glDrawable, int x, int y, int width, int height)
          Called when the on-screen component changes shape and/or position.
 void setInterpolation(float intp)
          Sets the current interpolation value for rendering.
 void setPasses(Pass[] passes)
          Sets the array of Pass objects to use during multi-pass rendering.
 void setPostProcessors(FrameProcessor[] post)
          Sets the array of FrameProcessors to use for post processing.
 void setViews(View[] views)
          Sets the array of View objects used for displaying multiple views.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitScreenRenderer

public SplitScreenRenderer(Visible drawable,
                           View view,
                           Context options)
Utility constructor so you don't have to put a single View in an array. This is the same as SplitScreenRenderer(drawable, new View[]{view}, options).


SplitScreenRenderer

public SplitScreenRenderer(Visible drawable,
                           View[] views,
                           Context options)
Constructs a Renderer to render a Visible to the screen.

Parameters:
drawable - the Visible to draw.
views - the views to use.
options - the rendering options to use. If this is null, the default set of options is used.
Method Detail

display

public void display(javax.media.opengl.GLAutoDrawable glDrawable)
Renders a frame to glDrawable.

Specified by:
display in interface javax.media.opengl.GLEventListener
Parameters:
glDrawable - the GLDrawable to render the frame to.

displayChanged

public void displayChanged(javax.media.opengl.GLAutoDrawable gLDrawable,
                           boolean modeChanged,
                           boolean deviceChanged)
Required for the GLEventListener interface. It doesn't do anything.

Specified by:
displayChanged in interface javax.media.opengl.GLEventListener

init

public void init(javax.media.opengl.GLAutoDrawable glDrawable)
Initializes the GLDrawable with the parts that are common to each frame. This also takes care of loading textures and configuring display lists.

Specified by:
init in interface javax.media.opengl.GLEventListener
Parameters:
glDrawable - the GLDrawable to render the frame to.

reshape

public void reshape(javax.media.opengl.GLAutoDrawable glDrawable,
                    int x,
                    int y,
                    int width,
                    int height)
Called when the on-screen component changes shape and/or position.

Specified by:
reshape in interface javax.media.opengl.GLEventListener
Parameters:
glDrawable - the GLDrawable to render the frame to.
x - the x position of the viewing window.
y - the y position of the viewing window.
width - the width of the viewing area.
height - the height of the viewing area.

setViews

public void setViews(View[] views)
Sets the array of View objects used for displaying multiple views. This method is synchronized to make sure it's safe to call at any time. However, you are responsible for calling the init methods of Views that are new, as well as calling deinit on those being removed. This must normally be done from the rendering thread.

Parameters:
views - the array.
Throws:
java.lang.NullPointerException - if views is null.

setPostProcessors

public void setPostProcessors(FrameProcessor[] post)
Sets the array of FrameProcessors to use for post processing. The order of the array is the order that they will be used in. This method is properly synchronized, so it is safe to call at any time. However, you are responsible for calling the init methods of FrameProcessors that are new, as well as calling deinit on those being removed. This must normally be done from the rendering thread.

Parameters:
post - the array of FrameProcessors.

setPasses

public void setPasses(Pass[] passes)
Sets the array of Pass objects to use during multi-pass rendering. This defaults to an array with one element, a TranslucentPass object.

Parameters:
passes - the array of Pass objects.

setInterpolation

public void setInterpolation(float intp)
Sets the current interpolation value for rendering. This can be used by Visible objects to interpolate between two states and display frames inbetween them.

Parameters:
intp - the interpolation value. This should be a value between zero and one.
Throws:
java.lang.IllegalArgumentException - if intp is less than zero or greater than one.