gl4java
Interface GLRunnable

All Superinterfaces:
java.lang.Runnable
All Known Implementing Classes:
GLAnimCanvas

public interface GLRunnable
extends java.lang.Runnable

This is the interface for a threaded renderer (animator thread). If an animation class, e.g. GLAnimCanvas, implements GLDrawable and this interface, you will benefit from the new context handling GLContext.gljFree().

See Also:
GLContext, GLDrawable, GLAnimCanvas

Method Summary
 void freeGLContext()
          Forces this thread to release it's GLContext ! To ensure this, this thread enables itself, and calls gljFree(true) to force the release !
 boolean isAlive()
          is the thread alive, means is started and not died ?
 boolean isSuspended()
          is the thread suspended, means is started but waiting, or not alive (ok :-| - but it is practical)
 boolean ownsThread(java.lang.Thread thread)
          Identifies this object with the given thread ..
 void ReInit()
          ReInit should be overwritten by you, to enter your re-initialisation within setSuspended(false)
 void run()
          The running loop for animations which initiates the call of display Be sure to force freeing the GL context with GLContext.gljFree()(true), if:
 void setSuspended(boolean suspend)
          Here we can (re)start or suspend animation ...
 void setSuspended(boolean suspend, boolean reInit)
          Here we can (re)start or suspend animation ...
 void start()
          This creates and start one singleton unique thread !
 void stop()
          This stops and destroys (deferred) our singleton unique thread !
 

Method Detail

start

public void start()
This creates and start one singleton unique thread !

stop

public void stop()
This stops and destroys (deferred) our singleton unique thread !

ownsThread

public boolean ownsThread(java.lang.Thread thread)
Identifies this object with the given thread .. If this object owns this thread, it must return true !

run

public void run()
The running loop for animations which initiates the call of display Be sure to force freeing the GL context with GLContext.gljFree()(true), if:
- you exit this run loop
- you suspend your thread -> wait
- you kill your thread ..
  
Also be sure, to implement this Runnable as Java2 does recomends ! Look at the example implementation GLAnimCanvas.run() !
Specified by:
run in interface java.lang.Runnable
See Also:
GLAnimCanvas.run(), setSuspended(boolean)

setSuspended

public void setSuspended(boolean suspend)
Here we can (re)start or suspend animation ... If the thread should be (re)started and is not alive -> killed, or never be started, it will be started !
Parameters:
suspend - if true the thread will be suspended, if false, the thread will be (re)started
See Also:
isAlive(), start()

setSuspended

public void setSuspended(boolean suspend,
                         boolean reInit)
Here we can (re)start or suspend animation ... If the thread should be (re)started and is not alive -> killed, or never be started, it will be started !
Parameters:
suspend - if true the thread will be suspended, if false, the thread will be (re)started
reInit - if true the ReInit will be called additionally, where the user can set additional initialisations
See Also:
ReInit(), isAlive(), start(), run()

isAlive

public boolean isAlive()
is the thread alive, means is started and not died ?
See Also:
run(), setSuspended(boolean), start(), stop()

isSuspended

public boolean isSuspended()
is the thread suspended, means is started but waiting, or not alive (ok :-| - but it is practical)
See Also:
run(), setSuspended(boolean), start(), stop()

ReInit

public void ReInit()
ReInit should be overwritten by you, to enter your re-initialisation within setSuspended(false)
See Also:
setSuspended(boolean)

freeGLContext

public void freeGLContext()
Forces this thread to release it's GLContext ! To ensure this, this thread enables itself, and calls gljFree(true) to force the release !
See Also:
setSuspended(boolean), run()