use of javax.microedition.khronos.egl.EGL10 in project Rajawali by Rajawali.
the class Capabilities method checkGLVersion.
private static void checkGLVersion() {
// Get an EGL context and display
final EGL10 egl = (EGL10) EGLContext.getEGL();
final EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
final int[] version = new int[2];
if (!egl.eglInitialize(display, version))
throw new IllegalStateException("Failed to initialize an EGL context while getting device capabilities.");
mEGLMajorVersion = version[0];
mEGLMinorVersion = version[1];
// RajLog.d("Device EGL Version: " + version[0] + "." + version[1]);
// Assume GLES 2 by default
mGLESMajorVersion = 2;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
// The API for GLES3 might exist, we need to check
// RajLog.d("Attempting to get an OpenGL ES 3 config.");
checkGLVersionIs3(egl, display);
}
egl.eglTerminate(display);
// RajLog.d("Determined GLES Major version to be: " + mGLESMajorVersion);
sGLChecked = true;
}
use of javax.microedition.khronos.egl.EGL10 in project Signal-Android by WhisperSystems.
the class BitmapUtil method getMaxTextureSize.
public static int getMaxTextureSize() {
final int IMAGE_MAX_BITMAP_DIMENSION = 2048;
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
int[] version = new int[2];
egl.eglInitialize(display, version);
int[] totalConfigurations = new int[1];
egl.eglGetConfigs(display, null, 0, totalConfigurations);
EGLConfig[] configurationsList = new EGLConfig[totalConfigurations[0]];
egl.eglGetConfigs(display, configurationsList, totalConfigurations[0], totalConfigurations);
int[] textureSize = new int[1];
int maximumTextureSize = 0;
for (int i = 0; i < totalConfigurations[0]; i++) {
egl.eglGetConfigAttrib(display, configurationsList[i], EGL10.EGL_MAX_PBUFFER_WIDTH, textureSize);
if (maximumTextureSize < textureSize[0])
maximumTextureSize = textureSize[0];
}
egl.eglTerminate(display);
return Math.max(maximumTextureSize, IMAGE_MAX_BITMAP_DIMENSION);
}
use of javax.microedition.khronos.egl.EGL10 in project AndEngine by nicolasgramlich.
the class AndEngine method checkEGLConfigChooserSupport.
private static void checkEGLConfigChooserSupport() throws DeviceNotSupportedException {
/* Get an EGL instance. */
final EGL10 egl = (EGL10) EGLContext.getEGL();
/* Get to the default display. */
final EGLDisplay eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
/* We can now initialize EGL for that display. */
final int[] version = new int[2];
egl.eglInitialize(eglDisplay, version);
// TODO Doesn't correlate to possible multisampling request in EngineOptions...
final ConfigChooser configChooser = new ConfigChooser(false);
try {
configChooser.chooseConfig(egl, eglDisplay);
} catch (final IllegalArgumentException e) {
throw new DeviceNotSupportedException(DeviceNotSupportedCause.EGLCONFIG_NOT_FOUND, e);
}
}
use of javax.microedition.khronos.egl.EGL10 in project platform_frameworks_base by android.
the class RenderTarget method focusNone.
public static void focusNone() {
EGL10 egl = (EGL10) EGLContext.getEGL();
egl.eglMakeCurrent(egl.eglGetCurrentDisplay(), EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
mCurrentTarget.set(null);
checkEglError(egl, "eglMakeCurrent");
}
use of javax.microedition.khronos.egl.EGL10 in project platform_frameworks_base by android.
the class RenderTarget method newTarget.
public static RenderTarget newTarget(int width, int height) {
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay eglDisplay = createDefaultDisplay(egl);
EGLConfig eglConfig = chooseEglConfig(egl, eglDisplay);
EGLContext eglContext = createContext(egl, eglDisplay, eglConfig);
EGLSurface eglSurface = createSurface(egl, eglDisplay, width, height);
RenderTarget result = new RenderTarget(eglDisplay, eglContext, eglSurface, 0, true, true);
result.addReferenceTo(eglSurface);
return result;
}
Aggregations