Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: GLES20: Called unimplemented OpenGL ES API

I am getting a "Called unimplemented OpenGL ES API" error, when trying the GLES20 Sample, provided by developer.android.com. I modified the sample, though. The reason was because I got an IllegalArgumentException in GLSurfaceView.BaseConfigChooser.chooseconfig, so i replaced mGLSurfaceView.setEGLContextClientVersion( 2 );

The new OnCreateMethod:

protected void onCreate( Bundle savedInstanceState )
{
    super.onCreate( savedInstanceState );
    mGLSurfaceView = new GLSurfaceView( this );

    mGLSurfaceView.setEGLConfigChooser( new EGLConfigChooser()
    {
        @Override
        public EGLConfig chooseConfig( EGL10 egl, EGLDisplay display )
        {
            EGLConfig[] configs = new EGLConfig[1];
            int[] num_config = new int[1];

            boolean check = false;

            int[] configSpec = { EGL10.EGL_DEPTH_SIZE, 16, EGL10.EGL_NONE };

            check = egl.eglInitialize( display, new int[] { 2, 0 } );

            if ( !check )
                return null;
            check = false;

            check = egl.eglChooseConfig( display, configSpec, configs, 1, num_config );
            if ( !check )
                return null;

            return configs[0];
        }
    } );

    mGLSurfaceView.setEGLContextFactory( new EGLContextFactory()
    {
        @Override
        public void destroyContext( EGL10 egl, EGLDisplay display, EGLContext context )
        {
            egl.eglDestroyContext( display, context );
        }

        @Override
        public EGLContext createContext( EGL10 egl, EGLDisplay display, EGLConfig eglConfig )
        {
            int[] attrib_list = new int[]{EGL10.EGL_VERSION, 2, EGL10.EGL_NONE};

            EGLContext context = egl.eglCreateContext( display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list  );
            return context;
        }
    });

    mGLSurfaceView.setRenderer( new GLES20TriangleRenderer( this ) );

    setContentView( mGLSurfaceView );
}

The "Called unimplemented OpenGL ES API" error occurs for example at GLES20.glCreateShader; or GLES20.glShaderSource.

I thought, maybe to check the version, so I called gl.glGetString( GLES20.GL_VERSION ); in public void onSurfaceCreated( GL10 gl, EGLConfig config ). glGetString returned "OpenGL ES-CM 1.0". OnSurfaceCreated is called after choosing the config and creating the context, so I really do not understand, why glGetString returns "OpenGL ES-CM 1.0".

I am using Android 2.2 API and tried the sample on a Android 2.2 Virtual device and on a HTC Wildfire, with Android 2.2.1.

I appreciate any help

like image 724
Coolkill Avatar asked May 08 '11 07:05

Coolkill


2 Answers

See this post - triangle opengl in android

As mentioned there, the emulators do not support GL2, but as that post mentions, it worked for me on an actual device.

like image 103
iDurocher Avatar answered Nov 06 '22 08:11

iDurocher


This is not an error, but a statement. It simply tells you that your target doesn't support OpenGL ES version 2.0.

like image 39
ognian Avatar answered Nov 06 '22 08:11

ognian