Пример #1
0
 void updateGraphicsConfiguration() {
   CapabilitiesImmutable capsChosen = getChosenCapabilities();
   EGLGraphicsConfiguration newConfig =
       (EGLGraphicsConfiguration)
           GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), capsChosen)
               .chooseGraphicsConfiguration(
                   capsChosen,
                   getRequestedCapabilities(),
                   chooser,
                   getScreen(),
                   VisualIDHolder.VID_UNDEFINED);
   if (null != newConfig) {
     // FIXME: setScreen( ... );
     setChosenCapabilities(newConfig.getChosenCapabilities());
     if (DEBUG) {
       System.err.println("updateGraphicsConfiguration(1): " + this);
     }
   }
 }
Пример #2
0
  protected static long createPBufferSurfaceImpl(
      EGLGraphicsConfiguration config, int width, int height, boolean useTexture) {
    final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) config.getScreen().getDevice();
    final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities();
    final int texFormat;

    if (useTexture) {
      texFormat = caps.getAlphaBits() > 0 ? EGL.EGL_TEXTURE_RGBA : EGL.EGL_TEXTURE_RGB;
    } else {
      texFormat = EGL.EGL_NO_TEXTURE;
    }

    if (DEBUG) {
      System.out.println("Pbuffer config: " + config);
    }

    final IntBuffer attrs =
        EGLGraphicsConfiguration.CreatePBufferSurfaceAttribList(width, height, texFormat);
    final long surf =
        EGL.eglCreatePbufferSurface(eglDevice.getHandle(), config.getNativeConfig(), attrs);
    if (EGL.EGL_NO_SURFACE == surf) {
      throw new GLException(
          "Creation of window surface (eglCreatePbufferSurface) failed, dim "
              + width
              + "x"
              + height
              + ", "
              + eglDevice
              + ", "
              + config
              + ", error 0x"
              + Integer.toHexString(EGL.eglGetError()));
    } else if (DEBUG) {
      System.err.println("PBuffer setSurface result: eglSurface 0x" + Long.toHexString(surf));
    }
    return surf;
  }