예제 #1
0
 private void maybeDoSingleThreadedWorkaround(
     Runnable eventDispatchThreadAction, Runnable invokeGLAction, boolean isReshape) {
   if (Threading.isSingleThreaded() && !Threading.isOpenGLThread()) {
     Threading.invokeOnOpenGLThread(eventDispatchThreadAction);
   } else {
     drawableHelper.invokeGL(pbufferDrawable, context, invokeGLAction, initAction);
   }
 }
예제 #2
0
 protected final void defaultDisplay() {
   if (sendDestroy) {
     sendDestroy = false;
     destroy();
     return;
   }
   final RecursiveLock _lock = getLock();
   _lock.lock();
   try {
     if (null == context) {
       boolean contextCreated = false;
       final GLDrawableImpl _drawable = drawable;
       if (null != _drawable
           && _drawable.isRealized()
           && 0 < _drawable.getWidth() * _drawable.getHeight()) {
         final GLContext[] shareWith = {null};
         if (!helper.isSharedGLContextPending(shareWith)) {
           if (!restoreGLEventListenerState()) {
             context = (GLContextImpl) _drawable.createContext(shareWith[0]);
             context.setContextCreationFlags(additionalCtxCreationFlags);
             contextCreated = true;
             // surface is locked/unlocked implicit by context's makeCurrent/release
             helper.invokeGL(_drawable, context, defaultDisplayAction, defaultInitAction);
           }
         }
       }
       if (DEBUG) {
         System.err.println("GLAutoDrawableBase.defaultDisplay: contextCreated " + contextCreated);
       }
     } else {
       // surface is locked/unlocked implicit by context's makeCurrent/release
       helper.invokeGL(drawable, context, defaultDisplayAction, defaultInitAction);
     }
   } finally {
     _lock.unlock();
   }
 }