Exemplo n.º 1
0
 public final synchronized void setRealized(boolean realizedArg) {
   if (realized != realizedArg) {
     if (DEBUG) {
       System.err.println(
           "setRealized: " + getClass().getName() + " " + realized + " -> " + realizedArg);
     }
     realized = realizedArg;
     AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice();
     if (realizedArg) {
       if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockSurface()) {
         throw new GLException(
             "GLDrawableImpl.setRealized(true): already realized, but surface not ready (lockSurface)");
       }
     } else {
       aDevice.lock();
     }
     try {
       setRealizedImpl();
       if (realizedArg) {
         updateHandle();
       } else {
         destroyHandle();
       }
     } finally {
       if (realizedArg) {
         unlockSurface();
       } else {
         aDevice.unlock();
       }
     }
   } else if (DEBUG) {
     System.err.println(
         "setRealized: " + getClass().getName() + " " + this.realized + " == " + realizedArg);
   }
 }
Exemplo n.º 2
0
 public final void swapBuffers() throws GLException {
   GLCapabilitiesImmutable caps =
       (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities();
   if (caps.getDoubleBuffered()) {
     if (!surface.surfaceSwap()) {
       int lockRes = lockSurface(); // it's recursive, so it's ok within [makeCurrent .. release]
       if (NativeSurface.LOCK_SURFACE_NOT_READY == lockRes) {
         return;
       }
       try {
         if (NativeSurface.LOCK_SURFACE_CHANGED == lockRes) {
           updateHandle();
         }
         swapBuffersImpl();
       } finally {
         unlockSurface();
       }
     }
   } else {
     GLContext ctx = GLContext.getCurrent();
     if (null != ctx && ctx.getGLDrawable() == this) {
       ctx.getGL().glFinish();
     }
   }
   surface.surfaceUpdated(this, surface, System.currentTimeMillis());
 }
Exemplo n.º 3
0
 @Override
 public final synchronized void setRealized(boolean realizedArg) {
   if (realized != realizedArg) {
     if (DEBUG) {
       System.err.println(
           getThreadName()
               + ": setRealized: "
               + getClass().getSimpleName()
               + " "
               + realized
               + " -> "
               + realizedArg);
     }
     realized = realizedArg;
     AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice();
     if (realizedArg) {
       if (surface instanceof ProxySurface) {
         ((ProxySurface) surface).createNotify();
       }
       if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockSurface()) {
         throw new GLException(
             "GLDrawableImpl.setRealized(true): Surface not ready (lockSurface)");
       }
     } else {
       aDevice.lock();
     }
     try {
       if (realizedArg) {
         setRealizedImpl();
         updateHandle();
       } else {
         destroyHandle();
         setRealizedImpl();
       }
     } finally {
       if (realizedArg) {
         unlockSurface();
       } else {
         aDevice.unlock();
         if (surface instanceof ProxySurface) {
           ((ProxySurface) surface).destroyNotify();
         }
       }
     }
   } else if (DEBUG) {
     System.err.println(
         getThreadName()
             + ": setRealized: "
             + getClass().getName()
             + " "
             + this.realized
             + " == "
             + realizedArg);
   }
 }