[Nexus One Android Development] d1mbu1b:
yes. but its made a bit easier since the render thread will always only read the data. good point however.

I managed to compile, link, and run a wholly native GLES executable.

Unfortunately, it dies on the create Surface step.

It performed all eglInitialization calls all the way up to eglCreateWindowSurface():

with the listed results.

I have seen this on the iphone and on the beagleboard (TI OMAP/powervr) when I didnt get the exact color depth correct. still digging.

*** In any event you can see the version returned by eglInitialize()

int eglHelloInit()
{
EGLDisplay eglDisplay;
EGLSurface eglSurface;
EGLContext eglContext;
EGLint versMajor;
EGLint versMinor;
EGLBoolean result;

eglDisplay = eglGetDisplay(0);
if (eglDisplay == EGL_DEFAULT_DISPLAY)
fprintf(stderr, "default display\n");
else if (eglDisplay == EGL_NO_DISPLAY)
fprintf(stderr, "no display\n");
else
fprintf(stderr, "other display\n");

result = eglInitialize(eglDisplay, &versMajor, &versMinor);
printf("GL version %d.%d\n", versMajor, versMinor);

if (result)
{
EGLint numConfigs;

if (eglGetConfigs(eglDisplay, 0, 0, &numConfigs))
{
printf("%d egl configs\n", numConfigs);

EGLConfig configs[32];
eglGetConfigs(eglDisplay, configs, 32, &numConfigs);

int i;
for (i = 0; i < numConfigs; i++)
{
EGLint redBits;
EGLint greenBits;
EGLint blueBits;
EGLint alphaBits;

EGLint bufferSize;
EGLint depthSize;
EGLint stencilSize;

EGLint caveat;
EGLint native;

EGLint level;
EGLint surfaceType;
EGLint visualType;
EGLint visualID;

eglGetConfigAttrib(eglDisplay, configs[i], EGL_RED_SIZE, &redBits);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_GREEN_SIZE, &greenBits);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_BLUE_SIZE, &blueBits);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_ALPHA_SIZE, &alphaBits);

eglGetConfigAttrib(eglDisplay, configs[i], EGL_BUFFER_SIZE, &bufferSize);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_DEPTH_SIZE, &depthSize);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_STENCIL_SIZE, &stencilSize);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_CONFIG_CAVEAT, &caveat);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_NATIVE_RENDERABLE, &native);

eglGetConfigAttrib(eglDisplay, configs[i], EGL_LEVEL, &level);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_SURFACE_TYPE, &surfaceType);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_NATIVE_VISUAL_TYPE, &visualType);
eglGetConfigAttrib(eglDisplay, configs[i], EGL_NATIVE_VISUAL_ID, &visualID);
printf
(
"config %d: rgba=%d:%d:%d:%d(%d), ds=%d:%d, "
"caveat=%04x, native=%d, level=%d, surface=%04x, visual=%04x, id=%d\n",
i + 1,
redBits, greenBits, blueBits, alphaBits, bufferSize, depthSize, stencilSize,
caveat, native, level, surfaceType, visualType, visualID
);
}

EGLint configAttribs[] =
{
//EGL_RED_SIZE, 4,
//EGL_GREEN_SIZE, 4,
//EGL_BLUE_SIZE, 4,
//EGL_ALPHA_SIZE, 4,
//EGL_DEPTH_SIZE, 16,
//EGL_BUFFER_SIZE, 16,
EGL_NONE
//EGL_BUFFER_SIZE, 32,
//EGL_SURFACE_TYPE, EGL_WINDOW_BIT, // EGL_WINDOW_BIT, EGL_PIXMAP_BIT,
};

EGLConfig eglConfig = 0;
if (!eglChooseConfig(eglDisplay, configAttribs, &eglConfig, 1, &numConfigs) || (numConfigs != 1))
{
printf("failed to find usable config =(\n");
}
else
{
GLint configID;
eglGetConfigAttrib(eglDisplay, eglConfig, EGL_CONFIG_ID, &configID);
printf("chose config %d\n", configID);
}

eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, 0);
if (eglContext == EGL_NO_CONTEXT)
printf("failed to allocate context\n");

eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, 0, 0);
if (eglSurface == EGL_NO_SURFACE)
printf("failed to create surface\n");

return eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
}
else
printf("GL get configs failed\n");
}
else
printf("GL init failed\n");

return(1);
}

Script started on Wed Jan 27 15:34:14 2010
sh-3.2$ adb shell
# cd /data
cd /data

# ./eg hello-egl
./hello-egl

other display

GL version 1.4

GL version 1.4

44 egl configs

config 1: rgba=4:4:4:4(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 2: rgba=4:4:4:4(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 3: rgba=4:4:4:4(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 4: rgba=5:5:5:1(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 5: rgba=5:5:5:1(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 6: rgba=5:5:5:1(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 7: rgba=5:6:5:0(16), ds=0:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

config 8: rgba=5:6:5:0(16), ds=16:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

config 9: rgba=5:6:5:0(16), ds=24:8, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

config 10: rgba=8:8:8:8(32), ds=0:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

config 11: rgba=8:8:8:8(32), ds=16:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

config 12: rgba=8:8:8:8(32), ds=24:8, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

config 13: rgba=4:4:4:4(16), ds=0:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0

config 14: rgba=4:4:4:4(16), ds=16:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0

config 15: rgba=4:4:4:4(16), ds=24:8, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0

config 16: rgba=5:5:5:1(16), ds=0:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0

config 17: rgba=5:5:5:1(16), ds=16:0, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0

config 18: rgba=5:5:5:1(16), ds=24:8, caveat=3051, native=0, level=0, surface=0403, visual=0000, id=0

config 19: rgba=5:6:5:0(16), ds=0:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0

config 20: rgba=5:6:5:0(16), ds=16:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0

config 21: rgba=5:6:5:0(16), ds=24:8, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0

config 22: rgba=8:8:8:8(32), ds=0:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0

config 23: rgba=8:8:8:8(32), ds=16:0, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0

config 24: rgba=8:8:8:8(32), ds=24:8, caveat=3051, native=0, level=0, surface=0407, visual=0000, id=0

config 25: rgba=4:4:4:4(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 26: rgba=4:4:4:4(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 27: rgba=4:4:4:4(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 28: rgba=5:5:5:1(16), ds=0:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 29: rgba=5:5:5:1(16), ds=16:0, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 30: rgba=5:5:5:1(16), ds=24:8, caveat=3038, native=0, level=0, surface=0403, visual=0000, id=0

config 31: rgba=5:6:5:0(16), ds=0:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

config 32: rgba=5:6:5:0(16), ds=16:0, caveat=3038, native=0, level=0, surface=0407, visual=0000, id=0

chose config 6

failed to create surface

Could not initialize egl

# exit
exit

sh-3.2$ exit
exit

Script done on Wed Jan 27 15:34:32 2010