Use OpenGL ES 3 on Android?

I downloaded Android NDK r9 and compiled an example application. I have a Galaxy Nexus smartphone with Android 4.3 update.

How can I find out programmatically whether OpenGL ES 3 supports on my device?

+4
source share
2 answers

The answer is in Android OpenGLES docs . Essentially, try creating a 3.0 EGLContext , and if that fails, you know that 3.0 is not supported.

The page also shows an alternative approach: create a context for a lower level (1.x or 2.x) and use it to call glGetString(GL_VERSION) . If the version line indicates that 3.x is supported, you must destroy this context and create a new one.

Update: this approach can be seen in the Grafika EglCore class. Follow what happens when FLAG_TRY_GLES3 is passed to the constructor.

+3
source

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


All Articles