net.jinx.video
Class DisplayList

java.lang.Object
  extended by net.jinx.video.DisplayList
All Implemented Interfaces:
Visible
Direct Known Subclasses:
CartesianGrid, CartesianOrigin, Model, VisibleDisplayList

public abstract class DisplayList
extends java.lang.Object
implements Visible

DisplayList provides the means to use OpenGL display lists to accelerate rendering.

API Stability: Stable.


Constructor Summary
DisplayList()
          Constructs a DisplayList.
 
Method Summary
 void deinit(Context opt)
          Causes this DisplayList to delete it's OpenGL display list.
 void dispose(Context opt)
          Causes the OpenGL list for this object to be deleted, releasing any memory it may occupy.
 void draw(Context opt)
          Renders this Visible to glDrawable.
 void init(Context opt)
          Causes this DisplayList to construct an OpenGL display list.
 boolean isListed()
          Provides the means to determine if this DisplayList has already constructed an OpenGL display list.
 void list(Context opt)
          Causes an OpenGL display list to be constructed for the calls in subDraw().
 void refresh()
          Signals to this DisplayList that is should re-list itself.
protected abstract  void subDraw(Context opt)
          The OpenGL calls in this method are what get wrapped in the display list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayList

public DisplayList()
Constructs a DisplayList.

Method Detail

init

public void init(Context opt)
Causes this DisplayList to construct an OpenGL display list. If you subclass DisplayList and your extension contains other Visibles, then their init methods MUST be called first.

Specified by:
init in interface Visible
Parameters:
opt - describes the rendering options that are being used.

deinit

public void deinit(Context opt)
Causes this DisplayList to delete it's OpenGL display list. If you subclass DisplayList and your extension contains other Visibles, then their deinit methods MUST be called first.

Specified by:
deinit in interface Visible
Parameters:
opt - describes the rendering options that are being used.

refresh

public void refresh()
Signals to this DisplayList that is should re-list itself. This will cause it to behave as though there is no OpenGL display list attached to it until the next time the renderer's display(GLDrawable) method is called.

If init(GLDrawable, Context) hasn't been called, or deinit(GLDrawable, Context) has, then this will do nothing.


draw

public void draw(Context opt)
Description copied from interface: Visible
Renders this Visible to glDrawable.

Specified by:
draw in interface Visible
Parameters:
opt - describes the rendering options that are being used.

subDraw

protected abstract void subDraw(Context opt)
The OpenGL calls in this method are what get wrapped in the display list.


list

public void list(Context opt)
Causes an OpenGL display list to be constructed for the calls in subDraw(). Until this method is called, the subDraw() method will be called whenever draw(net.java.games.jogl.GLDrawable, Context) is called. If this has been called before, the current list will be discarded and replaced.

Parameters:
opt - the Context object containing the rendering options to use.

dispose

public void dispose(Context opt)
Causes the OpenGL list for this object to be deleted, releasing any memory it may occupy. Does nothing if this DisplayList has not been listed yet.

Parameters:
opt - the Context object containing the rendering options to use.

isListed

public boolean isListed()
Provides the means to determine if this DisplayList has already constructed an OpenGL display list.

Returns:
true if it's been listed.