|
JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java (public API).
|
NEWT Utility class MainThread. More...
Classes | |
| class | UserApp |
Static Public Member Functions | |
| static void | main (final String[] args) throws SecurityException, NoSuchMethodException, ClassNotFoundException |
| Your new java application main entry, which pipelines your application. More... | |
| static MainThread | getSingleton () |
Static Public Attributes | |
| static final boolean | HINT_USE_MAIN_THREAD |
| if true, use the main thread EDT, otherwise AWT's EDT More... | |
| static boolean | useMainThread = false |
Static Protected Attributes | |
| static final boolean | DEBUG = Debug.debug("MainThread") |
NEWT Utility class MainThread.
FIXME: Update this documentation! This class just provides a main-thread utility, forking of a main java class on another thread while being able to continue doing platform specific things on the main-thread. The latter is essential for eg. MacOSX, where we continue to run NSApp.run().
This class provides a startup singleton main thread, from which a new thread with the users main class is launched.
Such behavior is necessary for native windowing toolkits, where the windowing management must happen on the so called main thread e.g. for Mac OS X !
Utilizing this class as a launchpad, now you are able to use a NEWT multithreaded application with window handling within the different threads, even on these restricted platforms.
To support your NEWT Window platform, you have to pass your main thread actions to invoke(..), have a look at the NEWT Mac OSX Window driver implementation.
TODO: Some hardcoded dependencies exist in this implementation, where you have to patch this code or factor it out.
If your platform is not Mac OS X, but you want to test your code without modifying this class, you have to set the system property newt.MainThread.force to true.
The code is compatible with all other platform, which support multithreaded windowing handling. Since those platforms won't trigger the main thread serialization, the main method will be simply executed, in case you haven't set newt.MainThread.force to true.
Test case on Mac OS X (or any other platform):
java -XstartOnFirstThread com.jogamp.newt.util.MainThread demos.es1.RedSquare -GL2 -GL2 -GL2 -GL2
Which starts 4 threads, each with a window and OpenGL rendering.
Definition at line 96 of file MainThread.java.
|
static |
Definition at line 316 of file MainThread.java.
|
static |
Your new java application main entry, which pipelines your application.
| ClassNotFoundException | |
| NoSuchMethodException | |
| SecurityException |
Definition at line 257 of file MainThread.java.
|
staticprotected |
Definition at line 117 of file MainThread.java.
|
static |
if true, use the main thread EDT, otherwise AWT's EDT
Definition at line 103 of file MainThread.java.
|
static |
Definition at line 115 of file MainThread.java.