2016-09-05 7 views
0

제 질문은 : GLSurfaceView가 api18 + 용 EGL 컨텍스트 3.0을 지원합니까? setEGLContextClientVersion (3) 후 충돌 accurs, 난에만 로이드 4.4.2 을 가지며 매니페스트 official documentation 상태로GLSurfaceView with opengl ES 3.0

<uses-feature android:glEsVersion="0x00030000" android:required="true"/> 
+0

합니까 장치 지원 ES 3.0 : 3.0을 사용할 수있는 경우

는 다음 당신이 할 수있는 확인하려면? –

답변

0

를 포함하는 하나 개의 장치를 시도하지 않았다 제가 사용하기 때문에, 장치가 지원하지 않을 OpenGL 3.0이므로 egl 컨텍스트 버전을 설정하기 전에이를 확인해야합니다.

그러나 매니페스트에 uses-feature에 대해 required=true이라고 표시된 경우 앱을 Google Play 스토어에 게시하면 해당 앱을 지원하지 않는 기기에 표시되지 않아야합니다. 따라서 다른 소스에서 APK를 다운로드하지 않으면 설치가 불가능합니다.

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; 
    } 
}