Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android OpenGL ES GL10 or GL11

What is the different beetween this, and how i can query what is supported by the actual phone? (GL10 or GL11)

i have a HTC Legend, that is supported GL11 or not? Or hero...etc... ?

like image 680
lacas Avatar asked Jan 23 '11 16:01

lacas


2 Answers

There's an API for that:

public int getGLVersion() 
{
    ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
    ConfigurationInfo info = am.getDeviceConfigurationInfo();
    return info.reqGlEsVersion;
}

The upper order 16 bits represent the major version and the lower order 16 bits the minor version. For more information, visit this link. So:

  • For OpenGLES 1.1, getGLVersion() == 0x00010001
  • For OpenGLES 2.0, getGLVersion() == 0x00020000

If you want the string representation (for display), call ConfigurationInfo.getGlEsVersion()

like image 182
Lior Avatar answered Oct 18 '22 20:10

Lior


You can use instanceof on your GL10 instance to test if GL11 or higher is supported:

public void onSurfaceCreated(GL10 gl, EGLConfig config)
{        
  if(gl instanceof GL11)
  {
    // ...
  }
}
like image 37
svdree Avatar answered Oct 18 '22 21:10

svdree