コード例 #1
0
  protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl(
      CapabilitiesImmutable capsChosen,
      CapabilitiesImmutable capsRequested,
      CapabilitiesChooser chooser,
      AbstractGraphicsScreen absScreen) {
    if (!(absScreen instanceof X11GraphicsScreen)) {
      throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here");
    }

    if (!(capsChosen instanceof GLCapabilitiesImmutable)) {
      throw new IllegalArgumentException(
          "This NativeWindowFactory accepts only GLCapabilities objects - chosen");
    }

    if (!(capsRequested instanceof GLCapabilitiesImmutable)) {
      throw new IllegalArgumentException(
          "This NativeWindowFactory accepts only GLCapabilities objects - requested");
    }

    if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) {
      throw new IllegalArgumentException(
          "This NativeWindowFactory accepts only GLCapabilitiesChooser objects");
    }

    if (!GLXUtil.isGLXAvailableOnServer((X11GraphicsDevice) absScreen.getDevice())) {
      if (null != fallbackX11GraphicsConfigurationFactory) {
        if (DEBUG) {
          System.err.println(
              "No GLX available, fallback to "
                  + fallbackX11GraphicsConfigurationFactory.getClass().getSimpleName()
                  + " for: "
                  + absScreen);
        }
        return fallbackX11GraphicsConfigurationFactory.chooseGraphicsConfiguration(
            capsChosen, capsRequested, chooser, absScreen);
      }
      throw new InternalError(
          "No GLX and no fallback GraphicsConfigurationFactory available for: " + absScreen);
    }
    return chooseGraphicsConfigurationStatic(
        (GLCapabilitiesImmutable) capsChosen, (GLCapabilitiesImmutable) capsRequested,
        (GLCapabilitiesChooser) chooser, (X11GraphicsScreen) absScreen);
  }
コード例 #2
0
 @Override
 public boolean isDeviceSupported(final AbstractGraphicsDevice device) {
   final boolean res;
   final X11GraphicsDevice x11Device =
       new X11GraphicsDevice(
           X11Util.openDisplay(device.getConnection()), device.getUnitID(), true /* owner */);
   x11Device.lock();
   try {
     res = GLXUtil.isGLXAvailableOnServer(x11Device);
   } finally {
     x11Device.unlock();
     x11Device.close();
   }
   if (DEBUG) {
     System.err.println(
         "GLX " + (res ? "is" : "not") + " available on device/server: " + x11Device);
   }
   return res;
 }