j3d.org OpenGL SWT Bindings

org.j3d.opengl.swt
Class Threading

java.lang.Object
  extended byorg.j3d.opengl.swt.Threading

public class Threading
extends java.lang.Object

This API provides access to the threading model for the implementation of JOGL on SWT.

This class is a re-implementation of the AWT-specific javax.media.opengl.Threading class that specifically targets the needs of SWT. The core package class uses a lot of AWT-specific code internally, which can cause rendering deadlocks, particularly on Mac OSX. Please use this class instead of the core class if you need this level of functionality. The functionality is the same, so the documentation there is applicable to this class.

Version:
$Revision: 1.1 $
Author:
Justin Couch

Method Summary
static void disableSingleThreading()
          If an implementation of the javax.media.opengl APIs offers a multithreading option but the default behavior is single-threading, this API provides a mechanism for end users to disable single-threading in this implementation.
static void invokeOnOpenGLThread(java.lang.Runnable r)
          Executes the passed Runnable on the single thread used for all OpenGL work in this javax.media.opengl API implementation.
static boolean isOpenGLThread()
          Indicates whether the current thread is the single thread on which this implementation of the javax.media.opengl APIs performs all of its OpenGL-related work.
static boolean isSingleThreaded()
          Indicates whether OpenGL work is being automatically forced to a single thread in this implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

disableSingleThreading

public static void disableSingleThreading()
If an implementation of the javax.media.opengl APIs offers a multithreading option but the default behavior is single-threading, this API provides a mechanism for end users to disable single-threading in this implementation.

Users are strongly discouraged from calling this method unless they are aware of all of the consequences and are prepared to enforce some amount of threading restrictions in their applications.

Currently there is no supported way to re-enable it once disabled, partly to discourage careless use of this method. This method should be called as early as possible in an application.


isSingleThreaded

public static boolean isSingleThreaded()
Indicates whether OpenGL work is being automatically forced to a single thread in this implementation.

Returns:
true if we are operating in single threaded mode

isOpenGLThread

public static boolean isOpenGLThread()
                              throws GLException
Indicates whether the current thread is the single thread on which this implementation of the javax.media.opengl APIs performs all of its OpenGL-related work. This method should only be called if the single-thread model is in effect.

Returns:
true when We are currently on the OpenGL thread
Throws:
GLException

invokeOnOpenGLThread

public static void invokeOnOpenGLThread(java.lang.Runnable r)
                                 throws GLException
Executes the passed Runnable on the single thread used for all OpenGL work in this javax.media.opengl API implementation. It is not specified exactly which thread is used for this purpose. This method should only be called if the single-thread model is in use and if the current thread is not the OpenGL thread (i.e., if isOpenGLThread() returns false). It is up to the end user to check to see whether the current thread is the OpenGL thread and either execute the Runnable directly or perform the work inside it.

Throws:
GLException

j3d.org OpenGL SWT Bindings

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