作为official documentation状态之一设备尝试过,该设备可能不支持OpenGL 3.0,所以你应该在设置egl上下文版本之前检查一下。
但是,如果您在清单中为uses-feature
指定required=true
,则一旦该应用在Google Play商店中发布,对于那些不支持它的设备,该应用将不可见。所以他们将无法安装它,除非他们设法从其他来源下载APK。
要检查3.0可你能做到以下几点:
private static double glVersion = 3.0;
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 " + glVersion + " context");
int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, (int) glVersion, EGL10.EGL_NONE };
// attempt to create a OpenGL ES 3.0 context
EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
return context; // returns null if 3.0 is not supported;
}
}
设备是否支持ES 3.0吗? –