Esempio n. 1
0
  /**
   * Note: This should only be called from the QFT under the AWT lock. This method is kept separate
   * from the initSurface() method below just to keep the code a bit cleaner.
   */
  private void initSurfaceNow(int width, int height) {
    boolean isOpaque = (getTransparency() == Transparency.OPAQUE);
    boolean success = false;

    switch (type) {
      case PBUFFER:
        success =
            initPbuffer(
                getNativeOps(), graphicsConfig.getNativeConfigInfo(), isOpaque, width, height);
        break;

      case TEXTURE:
        success =
            initTexture(
                getNativeOps(),
                isOpaque,
                isTexNonPow2Available(),
                isTexRectAvailable(),
                width,
                height);
        break;

      case FBOBJECT:
        success =
            initFBObject(
                getNativeOps(),
                isOpaque,
                isTexNonPow2Available(),
                isTexRectAvailable(),
                width,
                height);
        break;

      case FLIP_BACKBUFFER:
        success = initFlipBackbuffer(getNativeOps());
        break;

      default:
        break;
    }

    if (!success) {
      throw new OutOfMemoryError("can't create offscreen surface");
    }
  }