Skip to content Skip to sidebar Skip to footer

What Is The Right Way To Choose An Egl Config In Android?

I'm using my own GLSurfaceView and have been struggling with crashes related to the EGL config chooser for a while. It seems as though requesting RGB_565 by calling setEGLConfigCho

Solution 1:

From my experience I do not think setEGLConfigChooser() actually works correctly, i.e. it has a bug in its implementation. Across a number of devices I have seen crashes where setEGLConfigChooser() fails to select a valid context even if the underlying surface is of the correct type.

I have found the only reliable way to choose an EGL context is with a custom EGLConfigChooser. This also has the added benefit of choosing a config based on your own rules, e.g. surface must have depth and preferably RGB888 but can settle for RGB565. This is actually pretty straightforward to use eglChooseConfig() to get a list of possible configurations and then return one of them that matches your selection criteria.

Solution 2:

This gsoc code sample is for enabling MSAA. But it also contains code to select configurations, checking if they are available.

https://code.google.com/p/gdc2011-android-opengl/source/browse/trunk/src/com/example/gdc11/MultisampleConfigChooser.java#90

Post a Comment for "What Is The Right Way To Choose An Egl Config In Android?"