protected static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(
      Capabilities capabilities, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) {
    if (absScreen == null) {
      throw new IllegalArgumentException("AbstractGraphicsScreen is null");
    }
    if (!(absScreen instanceof X11GraphicsScreen)) {
      throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here");
    }
    X11GraphicsScreen x11Screen = (X11GraphicsScreen) absScreen;

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

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

    if (capabilities == null) {
      capabilities = new GLCapabilities(null);
    }

    boolean onscreen = capabilities.isOnscreen();
    boolean usePBuffer = ((GLCapabilities) capabilities).isPBuffer();

    GLCapabilities caps2 = (GLCapabilities) capabilities.clone();
    if (!caps2.isOnscreen()) {
      // OFFSCREEN !DOUBLE_BUFFER // FIXME DBLBUFOFFSCRN
      caps2.setDoubleBuffered(false);
    }

    X11GLXGraphicsConfiguration res;
    res =
        chooseGraphicsConfigurationFBConfig(
            (GLCapabilities) caps2, (GLCapabilitiesChooser) chooser, x11Screen);
    if (null == res) {
      if (usePBuffer) {
        throw new GLException(
            "Error: Couldn't create X11GLXGraphicsConfiguration based on FBConfig");
      }
      res =
          chooseGraphicsConfigurationXVisual(
              (GLCapabilities) caps2, (GLCapabilitiesChooser) chooser, x11Screen);
    }
    if (null == res) {
      throw new GLException("Error: Couldn't create X11GLXGraphicsConfiguration");
    }
    if (DEBUG) {
      System.err.println(
          "X11GLXGraphicsConfiguration.chooseGraphicsConfigurationStatic("
              + x11Screen
              + ","
              + caps2
              + "): "
              + res);
    }
    return res;
  }
Exemplo n.º 2
0
 public static GLCapabilities fixCaps(
     GLCapabilities caps, boolean onscreen, boolean pbuffer, boolean undecorated) {
   GLCapabilities caps2 = (GLCapabilities) caps.clone();
   caps2.setOnscreen(onscreen);
   caps2.setPBuffer(!onscreen && pbuffer);
   caps2.setDoubleBuffered(!onscreen);
   return caps2;
 }