GLSurfaceView with OpenGL ES 3.1 context

I am working on Android with OpenGL. I knew how to use GLSurfaceViewits custom derivation classes to create an OpenGL ES 2.0 context using the method GLSurfaceView:

setEGLContextClientVersion(2); 

and the context of OpenGL ES 3.0:

setEGLContextClientVersion(3); 

How to create context for OpenGL ES 3.1?

+4
source share
1 answer

You cannot explicitly request 3.1 when creating a context. Based on my understanding, 3.1 is not treated as a context type separate from 3.0. In fact, a context that supports 3.1 is just a context 3.0, which also supports the additional features of 3.1.

, :

setEGLContextClientVersion(3);

/, , , :

int[] vers = new int[2];
GLES30.glGetIntegerv(GLES30.GL_MAJOR_VERSION, vers, 0);
GLES30.glGetIntegerv(GLES30.GL_MINOR_VERSION, vers, 1);
if (vers[0] > 3 || (vers[0] == 3 && vers[1] >= 1)) {
    // We have at least ES 3.1.
}

EGL, 1,5 [*], , , ( EGL_CONTEXT_MAJOR_VERSION EGL_CONTEXT_MINOR_VERSION). 1.4 EGL_CONTEXT_CLIENT_VERSION, .

Android, 5.1.1 [*], - EGL 1.4. , GLSurfaceView . . , 3.1 3.0 - .

[*] , .

+3

Source: https://habr.com/ru/post/1608843/


All Articles