seteglcontextclientversion(2) not working correctly for OpenGL ES 2.0 device

3.9k Views Asked by At

I am trying to learn OpenGL ES 2.0, following a basic tutorial

http://www.droidnova.com/android-3d-game-tutorial-part-ii,328.html

This is the constructor of my GLSurfaceView derivation

public FirstOpenGLSurfaceView(Context context){
        super(context);
        // Set the Renderer for drawing on the GLSurfaceView
        setEGLContextClientVersion(2);
        _renderer = new FirstOpenGLRenderer();
        setRenderer(_renderer);
    }

After some experimentation, I have concluded that the project will fail to run properly if a call to seteglcontextclientversion(2) is issued (comment out this line of code and the rendering works.) Logcat indicates "Called unimplemented OpenGL ES API" whenever an attempt is made to run the above method.

I have updated the manifest and followed all of the advice in this post here... (Including the manifest.xml settings)

Android: GLES20: Called unimplemented OpenGL ES API

I have heard the suggestion that this may indicate that OpenGL ES 2.0 is not available on the devices in question (or that the emulator is being used.) I do not believe this to be true in this case, as when I run the following code... (Found in a few tutorials, I trust this code to be telling the truth)

// Check if the system supports OpenGL ES 2.0.
final ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
final ConfigurationInfo configurationInfo = activityManager.getDeviceConfigurationInfo();
final boolean supportsEs2 = configurationInfo.reqGlEsVersion >= 0x20000;

The value of supportsEs2 is 'true' and this applies on three independent devices, namely

  • Samsung Galaxy Tab 10.1 - Android 3.2 with 2.6.36.4 Kernel
  • Google Nexus S - Android 4.0.4 - Kernel 3.0.27
  • Samsung Galaxy S3 - Android 4.0.4 with Kernel 3.0.15

Has anyone experienced this before?

1

There are 1 best solutions below

0
On

I was also facing the same problem on my XOLO a500s, and using setEGLConfigChooser() solved my problem:

myGLSurface.setEGLConfigChooser(5, 6, 5, 0, 24, 8);
myGLSurface.setEGLContextClientVersion(2);
myGLSurface.setRenderer(new MyGLRenderer());

Where I got the values for setEGLConfigChooser(redSize, greenSize, blueSize, alphaSize, depthSize, stencilSize) from:

http://gfxbench.com/result.jsp