Beispiel #1
0
  public final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException {
    switch (ThreadingImpl.getMode()) {
      case ST_AWT:
        // FIXME: ideally should run all OpenGL work on the Java2D QFT
        // thread when it's enabled, but unfortunately there are
        // deadlock issues on X11 platforms when making our
        // heavyweight OpenGL contexts current on the QFT because we
        // perform the JAWT lock inside the makeCurrent()
        // implementation, which attempts to grab the AWT lock on the
        // QFT which is not allowed. For now, on X11 platforms,
        // continue to perform this work on the EDT.
        if (wait && Java2D.isOGLPipelineActive() && !ThreadingImpl.isX11()) {
          if (wait) {
            Java2D.invokeWithOGLContextCurrent(null, r);
          } else {

          }
        } else {
          AWTEDTExecutor.singleton.invoke(wait, r);
        }
        break;

      case ST_WORKER:
        ThreadingImpl.invokeOnWorkerThread(wait, r);
        break;

      default:
        throw new InternalError("Illegal single-threading mode " + ThreadingImpl.getMode());
    }
  }
Beispiel #2
0
 public final boolean isOpenGLThread() throws GLException {
   switch (ThreadingImpl.getMode()) {
     case ST_AWT:
       // FIXME: See the FIXME below in 'invokeOnOpenGLThread'
       if (Java2D.isOGLPipelineActive() && !ThreadingImpl.isX11()) {
         return Java2D.isQueueFlusherThread();
       } else {
         return EventQueue.isDispatchThread();
       }
     case ST_WORKER:
       if (Java2D.isOGLPipelineActive()) {
         // FIXME: ideally only the QFT would be considered to be the
         // "OpenGL thread", but we can not currently run all of
         // JOGL's OpenGL work on that thread. See the FIXME in
         // invokeOnOpenGLThread.
         return (Java2D.isQueueFlusherThread()
             || (ThreadingImpl.isX11() && GLWorkerThread.isWorkerThread()));
       } else {
         return GLWorkerThread.isWorkerThread();
       }
     default:
       throw new InternalError("Illegal single-threading mode " + ThreadingImpl.getMode());
   }
 }