Greets,

As with a lot of folks doing OpenGL ES dev it's really a test on
device situation. I'm really trying to get out the Typhon API (http://
typhon.egrsoftware.com/) which is an open source platform for real
time / game development working on the Droid. It also provides the
basis for a series of OpenGL ES tutorials for Android available that
will be incrementally released starting this week with or without
support for the Droid:
http://android-tactelus.com/

Of course I'd like to support Android 2.0 / Motorola Droid, but alas a
problem without a clear answer is occurring when I use EGL/GL directly
not using Google/Android provided GLSurfaceView. The following is the
basic setup code and works just fine on all previous Android versions
including 1.6 on the G1 and Ion, but it fails on the Droid. Note
"context.getConfigSpec()" returns a standard configuration:

new int[]
{
         EGL10.EGL_RED_SIZE, 5,
         EGL10.EGL_GREEN_SIZE, 6,
         EGL10.EGL_BLUE_SIZE, 5,
         EGL10.EGL_NONE
}

Now for the EGL/GL setup code...

//
---------------------------------------------------------------------------------------------
egl = (EGL10) EGLContext.getEGL();
glDisplay = egl.eglGetDisplay(EGL11.EGL_DEFAULT_DISPLAY);

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

EGLConfig[] configs = new EGLConfig[1];
int[] numValue = new int[1];

egl.eglChooseConfig(glDisplay, context.getConfigSpec(), configs, 1,
numValue);
glConfig = configs[0];

// Everything is fine here and a proper config is selected and I have
verified it by printing it out using
// "eglGetConfigAttrib"; this code is not in this sample though.

glContext = egl.eglCreateContext(glDisplay, glConfig,
EGL11.EGL_NO_CONTEXT, null);

// The following call fails with the following error:
// android_ws.c:312: ValidateWindowConfigFormat: Window and Config
pixel formats
// do not match
//
// android_ws.c:315: ValidateWindowConfigFormat: Window format was 0
(4), Config
// format was 2
// glGetError() also reports EGL_BAD_MATCH which is defined as
follows:
// EGL_BAD_MATCH is generated if the attributes of native_window do
not correspond to config or if config
// does not support rendering to windows (the EGL_SURFACE_TYPE
attribute does not contain
// EGL_WINDOW_BIT).
// I find it really strange that "eglChooseConfig" is returning a
valid config that exhibits the behavior described.
// I have tried many permutations of the configs returned by
"eglChooseConfig" and the attribute specs away
// from 565; IE 888 which is also returned as a valid config via
"eglChooseConfig" and all result in the above
// failure.

glSurface = egl.eglCreateWindowSurface(glDisplay, glConfig, holder,
null);

// The following call also fails because the call above failed. The
glGetError() return is also
// EGL_BAD_MATCH

egl.eglMakeCurrent(glDisplay, glSurface, glSurface, glContext);

gl = (GL11) (glContext.getGL());
//
---------------------------------------------------------------------------------------------

I'm not an OpenGL newbie and am a little frustrated with the above
especially since it works on all other Android devices and OS versions
I've tested on. Hopefully this is the only blocking issue for me
getting GL code to run on the Droid and Typhon released this week with
Android 2.0 / Droid support, but it sure is frustrating especially
since I've exhausted permutations of attribute array and the configs
returned by "eglChooseConfig". One would think if a config is returned
by "eglChooseConfig" that it is valid for the given display.

If anyone else has some raw EGL/GL code for creating a context that is
working on the Droid I'd be glad to take a look. I'm gathering David/
Hexage sets things up this way from seeing other messages from him.
David or anyone else have an idea? This is going into an open source
API, so any contributions are welcome.

Right now it looks like I'll be shipping out Typhon without Android
2.0 / Droid support which is a bummer as my schedule for this week
does not account for debugging Android 2.0 issues.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to