This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why my Android 4.3 Emulator could not support the OpenGL ES 3.0

The SDK and ADT have been updated in my IDE, and I create an Android 4.3 Emulator successfully. Then I run the OpenGL ES 3.0 demo code on the Emulator , but the Logcat output "OpenGL ES3.0 not supported on device...", The reason seems to be the OpenGL ES 3.0 context could not be created successfully. The demo comes from  book " The OpenGL ES 3.0 Programming guide". Settings have been done in the XML file.

     My PC : windows 7, 4GB RAM, Intel Core i3, GPU NVIDIA Geforce G7X550 Ti.  The information of the Emulator is Android 4.3.

     Code of creating  OpenGL ES3.0 context:

public class SimpleTexture2D extends Activity
{


   private final int CONTEXT_CLIENT_VERSION = 3;


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


      if ( detectOpenGLES30() )
      {
         // Tell the surface view we want to create an OpenGL ES 3.0-compatible
         // context, and set an OpenGL ES 3.0-compatible renderer.
         mGLSurfaceView.setEGLContextClientVersion ( CONTEXT_CLIENT_VERSION );
         mGLSurfaceView.setRenderer ( new SimpleTexture2DRenderer ( this ) );
      }
      else
      {
         Log.e ( "SimpleTexture2D", "OpenGL ES 3.0 not supported on device.  Exiting..." );
         finish();
      }


      setContentView ( mGLSurfaceView );
   }


   private boolean detectOpenGLES30()
   {
      ActivityManager am =
         ( ActivityManager ) getSystemService ( Context.ACTIVITY_SERVICE );
      ConfigurationInfo info = am.getDeviceConfigurationInfo();
      return ( info.reqGlEsVersion >= 0x30000 );
   }


   @Override
   protected void onResume()
   {
      // Ideally a game should implement onResume() and onPause()
      // to take appropriate action when the activity looses focus
      super.onResume();
      mGLSurfaceView.onResume();
   }


   @Override
   protected void onPause()
   {
      // Ideally a game should implement onResume() and onPause()
      // to take appropriate action when the activity looses focus
      super.onPause();
      mGLSurfaceView.onPause();
   }


   private GLSurfaceView mGLSurfaceView;
}
Parents Reply Children
  • Hi Autman,

    Feel free to email any mali specific queries to malidevelopers@arm.com, but this isn't really Mali related.

    setEGLContextClientVersion(2);//This should be 3???

    Maybe, I'd try it and see what happens... I would have thought that you would explicitly ask for a GLES3 context if you want one, although I can imagine implementations of GLES3 would just give you a GLES3 context even if you asked for GLES2, or they would give you a GLES2 context and explicitly ignore calls to core GLES3 functions in a GLES2 context (and report major version as 2!! could be the case here), one or the other. I'm not familiar with what the emulator does, although from reading around I'm surprised even GLES2 works for you!

    From my reading of the spec, GL_VERSION has to contain "OpenGL ES N.M vendor-specific information", but I can't say for sure if the emulator implementation follows this spec, maybe they always return ES 2.0? What does glGetIntegerv(GL_MAJOR_VERSION) return? I'm also still confused that by putting <uses-feature android:glEsVersion="0x00030000"/> in your manifest you could get anything other than 0x30000 from info.reqGlEsVersion, as from reading the description of the ConfigurationInfo class, it only contains application preferences declared in the manifest <uses-feature> and <uses-configuration> tags, NOT actual device capabilities. Your DetectOpenGLES30 function therefore seems unnecessary, as all it's doing is checking what value you put in the manifest. Am I missing something? Maybe the ConfigurationInfo reference is badly written and it's actually more general, and calling ActivityManager::getDeviceConfigurationInfo() really does return device capabilities and not application preferences...

    Bottom line, if you can't get it to give you a GLES 3 context it's very likely because it doesn't support it, maybe this is written down in the release notes for the emulator? I'd recommend trying your app out on a real GLES3 capable device instead

    Hope this helps,

    Chris