Hey guys, I'm having a bit of a problem enabling OpenGL ES 2.0 on my OUYA, and since it didnt look like anyone else had posted about it, I figured I'd ask.
So I have a simple GLSurfaceView called mySurface, and I'm calling setEGLContextClientVersion like so:
mySurface.setEGLContextClientVersion(2);
When I do this, LogCat fills with hundreds of the same error:
06-05 13:46:48.963: E/libEGL(1089): called unimplemented OpenGL ES API
And none of my drawing calls work. However, everything seems to work when I call
mySurface.setEGLContextClientVersion(1);
Normally, I would just assume that OUYA doesn't support 2.0 and move on with my life, but when I query the supported ES version using:
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
System.out.println(configurationInfo.reqGlEsVersion >= 0x20000);
I get "true", which apparently means that 2.0 is supported. I've tried adding
<uses-feature android:glEsVersion="0x00020000"></uses-feature>
to the manifest, and even
android:hardwareAccelerated="false"
(I don't know! Someone on the Internet told me it helped!)
Anyway, has anyone else run into this issue? Is there a workaround or should I just wait for the next system update?
Comments
Website
setEGLContextFactory(new ContextFactory());
private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
Log.w(TAG, "creating OpenGL ES 2.0 context");
checkEglError("Before eglCreateContext", egl);
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
checkEglError("After eglCreateContext", egl);
return context;
}
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
egl.eglDestroyContext(display, context);
}
}
http://stackoverflow.com/questions/8090608/how-to-set-opengl-version-in-either-egl-or-glsurfaceview
http://stackoverflow.com/questions/5930274/attribute-list-in-eglcreatecontext
http://developer.android.com/reference/android/opengl/GLSurfaceView.html