Monday, August 29, 2011

Android and OpenGL ES profile(s) detection

There are some sample queries posted on android-porting and rowboat mailing list where Android applications fail to detect supported OpenGl ES profiles. These applications end up throwing "OpenGL ES profile unsupported" error even though those profiles are actually supported either by the hardware or software of the target platform. Most common case is that of OpenGL ES 2.0 profile as you can see in the above hyper-links.

Problem with these Android applications, as far as I can find out is that they use Android APIs instead of standard OpenGL ES APIs to query the OpenGL ES version(s) supported by the target.

These Android APIs (e.g. detectOpenGLES20() in case of OpenGL ES 2.0) query the system properties (as in /system/build.prop file) to find out if target supports OpenGL ES 2.0.

To set the system wide OpenGL ES setting we need to add the corresponding property "ro.opengles.version=xxxxxx" in /system/build.prop
For OpenGL ES 2.0, set:

For OpenGL ES 1.1, set:

For OpenGL ES 1.0, set:
This property can be directly put in /system/build.prop file as it is or can be defined in Vendor specific Board Config files (e.g. device/vendor_name/target/ file) as follows:
ro.opengles.version = 131072
I have not tested these settings myself but as confirmed in this android-porting thread it definitely works :)

1 comment: