GlGetString () static call returns null in Android 5.0

My application needs to check the availability of some OpenGL ES features before launching.

This is done with the following Java code:

String extensions = GLES20.glGetString( GLES20.GL_EXTENSIONS );

      

And it worked on Android up to 4.4 but now returns null and the log says

10-28 17:53:49.475: E/libEGL(8930): call to OpenGL ES API with no current context (logged once per thread)

      

How do I get this information on Android 5.0? Do I need to create a new OpenGL ES context? And what's the easiest way to do this?

+3


source to share


1 answer


First of all, this is probably not an update issue, but a device-specific issue. Perhaps (you really do not have enough statistics on thousands of device models) this glGetString () behavior is less likely to happen on older models, but this knowledge is not worth looking for, it still does not solve the problem.

The khronos wiki explains that all OpenGL functions require a GL rendering context, but it is not a violation for some of these functions to return non-NULL when called without such a context.

You can find examples of initialization code here and here .



Even then, we ran into some devices that returned NULL for glGetString (GLES20.GL_RENDERER) ; they have different manufacturers, platform levels, etc. Our Crashlytcis data does not imply that this behavior is consistent across the same device.

Therefore, we had to use a fallback so that the application does not crash when this function returns null .

+1


source







All Articles