Personal tools
You are here: Home Blog Android EGL Querying your GL driver
Document Actions

Android EGL Querying your GL driver

by Nathan Cassano last modified 2009-06-16 19:31

I'm having to do some GL work with Android and I thought I'd share some code for querying your GL driver for it's complete list of configurations.

import javax.microedition.khronos.egl.*;
import android.util.Log;

...

EGL10 egl = (EGL10)EGLContext.getEGL();
EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

int[] version = new int[2];
egl.eglInitialize(dpy, version);

EGLConfig[] conf = new EGLConfig[100];
int[] num_conf = new int[100];
egl.eglGetConfigs(dpy, conf, 100, num_conf);

for(int i = 0; i < 100; i++)
{
int[] value = new int[1];

if (conf[i] != null)
{

Log.v("ANDROID", String.format("conf[%d] = %s", i, conf[i].toString() ) );

egl.eglGetConfigAttrib(dpy, conf[i], EGL10.EGL_RED_SIZE, value);
Log.v("ANDROID", String.format("EGL_RED_SIZE = %d", value[0] ) );

egl.eglGetConfigAttrib(dpy, conf[i], EGL10.EGL_BLUE_SIZE, value);
Log.v("ANDROID", String.format("EGL_BLUE_SIZE = %d", value[0] ) );

egl.eglGetConfigAttrib(dpy, conf[i], EGL10.EGL_GREEN_SIZE, value);
Log.v("ANDROID", String.format("EGL_GREEN_SIZE = %d", value[0] ) );

egl.eglGetConfigAttrib(dpy, conf[i], EGL10.EGL_ALPHA_SIZE, value);
Log.v("ANDROID", String.format("EGL_ALPHA_SIZE = %d", value[0] ) );

egl.eglGetConfigAttrib(dpy, conf[i], EGL10.EGL_DEPTH_SIZE, value);
Log.v("ANDROID", String.format("EGL_DEPTH_SIZE = %d", value[0] ) );

egl.eglGetConfigAttrib(dpy, conf[i], EGL10.EGL_ALPHA_FORMAT, value);
Log.v("ANDROID", String.format("EGL_ALPHA_FORMAT = %d", value[0] ) );

egl.eglGetConfigAttrib(dpy, conf[i], EGL10.EGL_ALPHA_MASK_SIZE, value);
Log.v("ANDROID", String.format("EGL_ALPHA_MASK_SIZE = %d", value[0] ) );

}
else
{
break;
}
}
In my case this is the result I got for the native HTC G1 GL driver.
EGLConfigImpl@430f5b08
EGL_RED_SIZE = 5
EGL_BLUE_SIZE = 5
EGL_GREEN_SIZE = 5
EGL_ALPHA_SIZE = 1
EGL_DEPTH_SIZE = 0
EGL_ALPHA_FORMAT = 0
EGL_ALPHA_MASK_SIZE = 0
EGLConfigImpl@430f6e58
EGL_RED_SIZE = 5
EGL_BLUE_SIZE = 5
EGL_GREEN_SIZE = 5
EGL_ALPHA_SIZE = 1
EGL_DEPTH_SIZE = 0
EGL_ALPHA_FORMAT = 0
EGL_ALPHA_MASK_SIZE = 0
EGLConfigImpl@430fc308
EGL_RED_SIZE = 5
EGL_BLUE_SIZE = 5
EGL_GREEN_SIZE = 5
EGL_ALPHA_SIZE = 1
EGL_DEPTH_SIZE = 16
EGL_ALPHA_FORMAT = 16
EGL_ALPHA_MASK_SIZE = 16
...

« May 2013 »
Su Mo Tu We Th Fr Sa
1234
567891011
12131415161718
19202122232425
262728293031
 

Powered by Plone CMS, the Open Source Content Management System