Exemplo n.º 1
0
 private static List<GLCapabilitiesImmutable> getAvailableEGLConfigs(
     EGLGraphicsDevice eglDisplay, GLCapabilitiesImmutable caps) {
   final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1);
   if (!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) {
     throw new GLException(
         "EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "
             + EGLContext.toHexString(EGL.eglGetError()));
   }
   if (0 < numConfigs.get(0)) {
     final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0));
     final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(caps);
     final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(caps);
     if (EGL.eglChooseConfig(
             eglDisplay.getHandle(), attrs, configs, configs.capacity(), numConfigs)
         && numConfigs.get(0) > 0) {
       return EGLGraphicsConfigurationFactory.eglConfigs2GLCaps(
           eglDisplay,
           caps.getGLProfile(),
           configs,
           numConfigs.get(0),
           winattrmask,
           false /* forceTransparentFlag */);
     }
   }
   return new ArrayList<GLCapabilitiesImmutable>(0);
 }
Exemplo n.º 2
0
 /**
  * @param capsRequested
  * @param absScreen
  * @param eglConfigID {@link EGL#EGL_CONFIG_ID} for which the config is being created for.
  * @return
  * @throws GLException if invalid EGL display.
  */
 public static EGLGraphicsConfiguration create(
     GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) {
   final AbstractGraphicsDevice absDevice = absScreen.getDevice();
   if (null == absDevice || !(absDevice instanceof EGLGraphicsDevice)) {
     throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice");
   }
   final long dpy = absDevice.getHandle();
   if (dpy == EGL.EGL_NO_DISPLAY) {
     throw new GLException("Invalid EGL display: " + absDevice);
   }
   final long cfg = EGLConfigId2EGLConfig(dpy, eglConfigID);
   if (0 < cfg) {
     final GLRendererQuirks defaultQuirks =
         GLRendererQuirks.getStickyDeviceQuirks(
             GLDrawableFactory.getEGLFactory().getDefaultDevice());
     final int winattrmask =
         GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsRequested);
     final EGLGLCapabilities caps =
         EGLConfig2Capabilities(
             defaultQuirks,
             (EGLGraphicsDevice) absDevice,
             capsRequested.getGLProfile(),
             cfg,
             winattrmask,
             false);
     return new EGLGraphicsConfiguration(
         absScreen, caps, capsRequested, new DefaultGLCapabilitiesChooser());
   }
   return null;
 }