android.opengl.EGLDisplay Java Examples

The following examples show how to use android.opengl.EGLDisplay. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EGLSurfaceTexture.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private static EGLConfig chooseEGLConfig(EGLDisplay display) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  boolean success =
      EGL14.eglChooseConfig(
          display,
          EGL_CONFIG_ATTRIBUTES,
          /* attrib_listOffset= */ 0,
          configs,
          /* configsOffset= */ 0,
          /* config_size= */ 1,
          numConfigs,
          /* num_configOffset= */ 0);
  if (!success || numConfigs[0] <= 0 || configs[0] == null) {
    throw new GlException(
        Util.formatInvariant(
            /* format= */ "eglChooseConfig failed: success=%b, numConfigs[0]=%d, configs[0]=%s",
            success, numConfigs[0], configs[0]));
  }

  return configs[0];
}
 
Example #2
Source File: EglCore.java    From sealrtc-android with MIT License 6 votes vote down vote up
/** Writes the current display, context, and surface to the log. */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.i(
            TAG,
            "Current EGL ("
                    + msg
                    + "): display="
                    + display
                    + ", context="
                    + context
                    + ", surface="
                    + surface);
}
 
Example #3
Source File: EglUtil.java    From SimpleVideoEditor with Apache License 2.0 6 votes vote down vote up
/**
 * Destroys the GL context identified by {@code eglDisplay} and {@code eglContext}.
 */
static void destroyEglContext(EGLDisplay eglDisplay, EGLContext eglContext) {
    EGL14.eglMakeCurrent(eglDisplay,
            EGL14.EGL_NO_SURFACE,
            EGL14.EGL_NO_SURFACE,
            EGL14.EGL_NO_CONTEXT);
    int error = EGL14.eglGetError();
    if (error != EGL14.EGL_SUCCESS) {
        throw new RuntimeException("error releasing context: " + error);
    }
    EGL14.eglDestroyContext(eglDisplay, eglContext);
    error = EGL14.eglGetError();
    if (error != EGL14.EGL_SUCCESS) {
        throw new RuntimeException("error destroying context: " + error);
    }
}
 
Example #4
Source File: EGLSurfaceTexture.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private static EGLContext createEGLContext(
    EGLDisplay display, EGLConfig config, @SecureMode int secureMode) {
  int[] glAttributes;
  if (secureMode == SECURE_MODE_NONE) {
    glAttributes = new int[] {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  } else {
    glAttributes =
        new int[] {
          EGL14.EGL_CONTEXT_CLIENT_VERSION,
          2,
          EGL_PROTECTED_CONTENT_EXT,
          EGL14.EGL_TRUE,
          EGL14.EGL_NONE
        };
  }
  EGLContext context =
      EGL14.eglCreateContext(
          display, config, android.opengl.EGL14.EGL_NO_CONTEXT, glAttributes, 0);
  if (context == null) {
    throw new GlException("eglCreateContext failed");
  }
  return context;
}
 
Example #5
Source File: EglBase14.java    From UltraGpuImage with MIT License 6 votes vote down vote up
private static EGLContext createEglContext(
    @Nullable EglBase14.Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) {
  if (sharedContext != null && sharedContext.egl14Context == EGL14.EGL_NO_CONTEXT) {
    throw new RuntimeException("Invalid sharedContext");
  }
  int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  EGLContext rootContext =
      sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Context;
  final EGLContext eglContext;
  synchronized (EglBase.lock) {
    eglContext = EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttributes, 0);
  }
  if (eglContext == EGL14.EGL_NO_CONTEXT) {
    throw new RuntimeException(
        "Failed to create EGL context: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  return eglContext;
}
 
Example #6
Source File: EglBase14.java    From UltraGpuImage with MIT License 6 votes vote down vote up
private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  if (!EGL14.eglChooseConfig(
          eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) {
    throw new RuntimeException(
        "eglChooseConfig failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  if (numConfigs[0] <= 0) {
    throw new RuntimeException("Unable to find any matching EGL config");
  }
  final EGLConfig eglConfig = configs[0];
  if (eglConfig == null) {
    throw new RuntimeException("eglChooseConfig returned null");
  }
  return eglConfig;
}
 
Example #7
Source File: EGLSurfaceTexture.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private static EGLConfig chooseEGLConfig(EGLDisplay display) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  boolean success =
      EGL14.eglChooseConfig(
          display,
          EGL_CONFIG_ATTRIBUTES,
          /* attrib_listOffset= */ 0,
          configs,
          /* configsOffset= */ 0,
          /* config_size= */ 1,
          numConfigs,
          /* num_configOffset= */ 0);
  if (!success || numConfigs[0] <= 0 || configs[0] == null) {
    throw new GlException(
        Util.formatInvariant(
            /* format= */ "eglChooseConfig failed: success=%b, numConfigs[0]=%d, configs[0]=%s",
            success, numConfigs[0], configs[0]));
  }

  return configs[0];
}
 
Example #8
Source File: GLSurfaceView2.java    From java6-android-glframework with Mozilla Public License 2.0 6 votes vote down vote up
public EGLSurface createWindowSurface(EGLDisplay display, EGLConfig config, Object nativeWindow)
{
   EGLSurface result = null;
   try
   {
      result = EGL14.eglCreateWindowSurface(display, config, nativeWindow, s_DEFAULT_SURFACE_ATTRIBS, 0);
   }
   catch (IllegalArgumentException e)
   {
      // This exception indicates that the surface flinger surface
      // is not valid. This can happen if the surface flinger surface has
      // been torn down, but the application has not yet been
      // notified via SurfaceHolder.Callback.surfaceDestroyed.
      // In theory the application should be notified first,
      // but in practice sometimes it is not. See b/4588890
      Log.e(s_TAG, "eglCreateWindowSurface", e);
   }
   return result;
}
 
Example #9
Source File: EglBase14.java    From VideoCRE with MIT License 6 votes vote down vote up
private static EGLContext createEglContext(
    EglBase14.Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) {
  if (sharedContext != null && sharedContext.egl14Context == EGL14.EGL_NO_CONTEXT) {
    throw new RuntimeException("Invalid sharedContext");
  }
  int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  EGLContext rootContext =
      sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Context;
  final EGLContext eglContext;
  synchronized (EglBase.lock) {
    eglContext = EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttributes, 0);
  }
  if (eglContext == EGL14.EGL_NO_CONTEXT) {
    throw new RuntimeException(
        "Failed to create EGL context: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  return eglContext;
}
 
Example #10
Source File: EGLSurfaceTexture.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static EGLContext createEGLContext(
    EGLDisplay display, EGLConfig config, @SecureMode int secureMode) {
  int[] glAttributes;
  if (secureMode == SECURE_MODE_NONE) {
    glAttributes = new int[] {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  } else {
    glAttributes =
        new int[] {
          EGL14.EGL_CONTEXT_CLIENT_VERSION,
          2,
          EGL_PROTECTED_CONTENT_EXT,
          EGL14.EGL_TRUE,
          EGL14.EGL_NONE
        };
  }
  EGLContext context =
      EGL14.eglCreateContext(
          display, config, android.opengl.EGL14.EGL_NO_CONTEXT, glAttributes, 0);
  if (context == null) {
    throw new GlException("eglCreateContext failed");
  }
  return context;
}
 
Example #11
Source File: EGLSurfaceTexture.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static EGLConfig chooseEGLConfig(EGLDisplay display) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  boolean success =
      EGL14.eglChooseConfig(
          display,
          EGL_CONFIG_ATTRIBUTES,
          /* attrib_listOffset= */ 0,
          configs,
          /* configsOffset= */ 0,
          /* config_size= */ 1,
          numConfigs,
          /* num_configOffset= */ 0);
  if (!success || numConfigs[0] <= 0 || configs[0] == null) {
    throw new GlException(
        Util.formatInvariant(
            /* format= */ "eglChooseConfig failed: success=%b, numConfigs[0]=%d, configs[0]=%s",
            success, numConfigs[0], configs[0]));
  }

  return configs[0];
}
 
Example #12
Source File: GLSurfaceView2.java    From java6-android-glframework with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public EGLConfig chooseConfig(EGLDisplay display, EGLConfig[] configs)
{
   for (EGLConfig config : configs)
   {
      int d = findConfigAttrib(display, config, EGL14.EGL_DEPTH_SIZE, 0);
      int s = findConfigAttrib(display, config, EGL14.EGL_STENCIL_SIZE, 0);

      if ((d >= depthSize) && (s >= stencilSize))
      {
         int r = findConfigAttrib(display, config, EGL14.EGL_RED_SIZE, 0);
         int g = findConfigAttrib(display, config, EGL14.EGL_GREEN_SIZE, 0);
         int b = findConfigAttrib(display, config, EGL14.EGL_BLUE_SIZE, 0);
         int a = findConfigAttrib(display, config, EGL14.EGL_ALPHA_SIZE, 0);

         if ((r == redSize) && (g == greenSize) && (b == blueSize) && (a == alphaSize))
         {
            return config;
         }
      }
   }
   return null;
}
 
Example #13
Source File: EGLSurfaceTexture.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static EGLConfig chooseEGLConfig(EGLDisplay display) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  boolean success =
      EGL14.eglChooseConfig(
          display,
          EGL_CONFIG_ATTRIBUTES,
          /* attrib_listOffset= */ 0,
          configs,
          /* configsOffset= */ 0,
          /* config_size= */ 1,
          numConfigs,
          /* num_configOffset= */ 0);
  if (!success || numConfigs[0] <= 0 || configs[0] == null) {
    throw new GlException(
        Util.formatInvariant(
            /* format= */ "eglChooseConfig failed: success=%b, numConfigs[0]=%d, configs[0]=%s",
            success, numConfigs[0], configs[0]));
  }

  return configs[0];
}
 
Example #14
Source File: EglBase14Impl.java    From webrtc_android with MIT License 6 votes vote down vote up
private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  if (!EGL14.eglChooseConfig(
          eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) {
    throw new RuntimeException(
        "eglChooseConfig failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  if (numConfigs[0] <= 0) {
    throw new RuntimeException("Unable to find any matching EGL config");
  }
  final EGLConfig eglConfig = configs[0];
  if (eglConfig == null) {
    throw new RuntimeException("eglChooseConfig returned null");
  }
  return eglConfig;
}
 
Example #15
Source File: EGLSurfaceTexture.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private static EGLConfig chooseEGLConfig(EGLDisplay display) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  boolean success =
      EGL14.eglChooseConfig(
          display,
          EGL_CONFIG_ATTRIBUTES,
          /* attrib_listOffset= */ 0,
          configs,
          /* configsOffset= */ 0,
          /* config_size= */ 1,
          numConfigs,
          /* num_configOffset= */ 0);
  if (!success || numConfigs[0] <= 0 || configs[0] == null) {
    throw new GlException(
        Util.formatInvariant(
            /* format= */ "eglChooseConfig failed: success=%b, numConfigs[0]=%d, configs[0]=%s",
            success, numConfigs[0], configs[0]));
  }

  return configs[0];
}
 
Example #16
Source File: EGLSurfaceTexture.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private static EGLContext createEGLContext(
    EGLDisplay display, EGLConfig config, @SecureMode int secureMode) {
  int[] glAttributes;
  if (secureMode == SECURE_MODE_NONE) {
    glAttributes = new int[] {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  } else {
    glAttributes =
        new int[] {
          EGL14.EGL_CONTEXT_CLIENT_VERSION,
          2,
          EGL_PROTECTED_CONTENT_EXT,
          EGL14.EGL_TRUE,
          EGL14.EGL_NONE
        };
  }
  EGLContext context =
      EGL14.eglCreateContext(
          display, config, android.opengl.EGL14.EGL_NO_CONTEXT, glAttributes, 0);
  if (context == null) {
    throw new GlException("eglCreateContext failed");
  }
  return context;
}
 
Example #17
Source File: EGLSurfaceTexture.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static EGLContext createEGLContext(
    EGLDisplay display, EGLConfig config, @SecureMode int secureMode) {
  int[] glAttributes;
  if (secureMode == SECURE_MODE_NONE) {
    glAttributes = new int[] {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  } else {
    glAttributes =
        new int[] {
          EGL14.EGL_CONTEXT_CLIENT_VERSION,
          2,
          EGL_PROTECTED_CONTENT_EXT,
          EGL14.EGL_TRUE,
          EGL14.EGL_NONE
        };
  }
  EGLContext context =
      EGL14.eglCreateContext(
          display, config, android.opengl.EGL14.EGL_NO_CONTEXT, glAttributes, 0);
  if (context == null) {
    throw new GlException("eglCreateContext failed");
  }
  return context;
}
 
Example #18
Source File: EglBase14.java    From VideoCRE with MIT License 6 votes vote down vote up
private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttributes) {
  EGLConfig[] configs = new EGLConfig[1];
  int[] numConfigs = new int[1];
  if (!EGL14.eglChooseConfig(
          eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs, 0)) {
    throw new RuntimeException(
        "eglChooseConfig failed: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  if (numConfigs[0] <= 0) {
    throw new RuntimeException("Unable to find any matching EGL config");
  }
  final EGLConfig eglConfig = configs[0];
  if (eglConfig == null) {
    throw new RuntimeException("eglChooseConfig returned null");
  }
  return eglConfig;
}
 
Example #19
Source File: EGLSurfaceTexture.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private static EGLContext createEGLContext(
    EGLDisplay display, EGLConfig config, @SecureMode int secureMode) {
  int[] glAttributes;
  if (secureMode == SECURE_MODE_NONE) {
    glAttributes = new int[] {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  } else {
    glAttributes =
        new int[] {
          EGL14.EGL_CONTEXT_CLIENT_VERSION,
          2,
          EGL_PROTECTED_CONTENT_EXT,
          EGL14.EGL_TRUE,
          EGL14.EGL_NONE
        };
  }
  EGLContext context =
      EGL14.eglCreateContext(
          display, config, EGL14.EGL_NO_CONTEXT, glAttributes, 0);
  if (context == null) {
    throw new GlException("eglCreateContext failed");
  }
  return context;
}
 
Example #20
Source File: EglCore.java    From kickflip-android-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * Writes the current display, context, and surface to the log.
 */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context +
            ", surface=" + surface);
}
 
Example #21
Source File: DummySurface.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(24)
private static @SecureMode int getSecureModeV24(Context context) {
  if (Util.SDK_INT < 26 && ("samsung".equals(Util.MANUFACTURER) || "XT1650".equals(Util.MODEL))) {
    // Samsung devices running Nougat are known to be broken. See
    // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802].
    // Moto Z XT1650 is also affected. See
    // https://github.com/google/ExoPlayer/issues/3215.
    return SECURE_MODE_NONE;
  }
  if (Util.SDK_INT < 26 && !context.getPackageManager().hasSystemFeature(
      PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE)) {
    // Pre API level 26 devices were not well tested unless they supported VR mode.
    return SECURE_MODE_NONE;
  }
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS);
  if (eglExtensions == null) {
    return SECURE_MODE_NONE;
  }
  if (!eglExtensions.contains(EXTENSION_PROTECTED_CONTENT)) {
    return SECURE_MODE_NONE;
  }
  // If we can't use surfaceless contexts, we use a protected 1 * 1 pixel buffer surface. This may
  // require support for EXT_protected_surface, but in practice it works on some devices that
  // don't have that extension. See also https://github.com/google/ExoPlayer/issues/3558.
  return eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT)
      ? SECURE_MODE_SURFACELESS_CONTEXT
      : SECURE_MODE_PROTECTED_PBUFFER;
}
 
Example #22
Source File: EGLSurfaceTexture.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static EGLDisplay getDefaultDisplay() {
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  if (display == null) {
    throw new GlException("eglGetDisplay failed");
  }

  int[] version = new int[2];
  boolean eglInitialized =
      EGL14.eglInitialize(display, version, /* majorOffset= */ 0, version, /* minorOffset= */ 1);
  if (!eglInitialized) {
    throw new GlException("eglInitialize failed");
  }
  return display;
}
 
Example #23
Source File: RecordableSurfaceView.java    From recordablesurfaceview with Apache License 2.0 5 votes vote down vote up
EGLConfig chooseEglConfig(EGLDisplay eglDisplay) {
    int[] configsCount = new int[]{0};
    EGLConfig[] configs = new EGLConfig[1];
    EGL14.eglChooseConfig(eglDisplay, config, 0, configs, 0, configs.length, configsCount,
            0);
    return configs[0];
}
 
Example #24
Source File: EglCore.java    From MockCamera with Apache License 2.0 5 votes vote down vote up
/**
 * Writes the current display, context, and surface to the log.
 */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.d(TAG,"Current EGL (" + msg + "): display=" + display + ", context=" + context +
            ", surface=" + surface);
}
 
Example #25
Source File: EglCore.java    From IjkVRPlayer with Apache License 2.0 5 votes vote down vote up
/**
 * Writes the current display, context, and surface to the log.
 */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context +
            ", surface=" + surface);
}
 
Example #26
Source File: EglCore.java    From LiveVideoBroadcaster with Apache License 2.0 5 votes vote down vote up
/**
 * Writes the current display, activity, and surface to the log.
 */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", activity=" + context +
            ", surface=" + surface);
}
 
Example #27
Source File: EGLSurfaceTexture.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private static EGLDisplay getDefaultDisplay() {
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  if (display == null) {
    throw new GlException("eglGetDisplay failed");
  }

  int[] version = new int[2];
  boolean eglInitialized =
      EGL14.eglInitialize(display, version, /* majorOffset= */ 0, version, /* minorOffset= */ 1);
  if (!eglInitialized) {
    throw new GlException("eglInitialize failed");
  }
  return display;
}
 
Example #28
Source File: EglCore.java    From FuAgoraDemoDroid with MIT License 5 votes vote down vote up
/**
 * Writes the current display, context, and surface to the log.
 */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context +
            ", surface=" + surface);
}
 
Example #29
Source File: EglCore.java    From Fatigue-Detection with MIT License 5 votes vote down vote up
/**
 * Writes the current display, context, and surface to the log.
 */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context +
            ", surface=" + surface);
}
 
Example #30
Source File: EglBase14.java    From VideoCRE with MIT License 5 votes vote down vote up
private static EGLDisplay getEglDisplay() {
  EGLDisplay eglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  if (eglDisplay == EGL14.EGL_NO_DISPLAY) {
    throw new RuntimeException(
        "Unable to get EGL14 display: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  int[] version = new int[2];
  if (!EGL14.eglInitialize(eglDisplay, version, 0, version, 1)) {
    throw new RuntimeException(
        "Unable to initialize EGL14: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  return eglDisplay;
}