guich
unread,Oct 16, 2012, 12:58:05 PM10/16/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to android-ndk
Hi,
I have a code that works fine on Sony Xperia S with android 2.3.7. I
just installed it in my Galaxy Tab 2 and it fails. The error is
EGL_BAD_CONFIG when calling eglCreateContext.
This is the code:
bool initGLES(ScreenSurface screen)
{
int32 i;
const EGLint attribs[] =
{
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_NONE
};
EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE };
EGLDisplay display;
EGLConfig config;
EGLint numConfigs;
EGLint format;
EGLSurface surface;
EGLContext context;
EGLint width;
EGLint height;
if ((display = eglGetDisplay(EGL_DEFAULT_DISPLAY)) ==
EGL_NO_DISPLAY) {debug("eglGetDisplay() returned error %d",
eglGetError()); return false;}
if (!eglInitialize(display, 0,
0)) {debug("eglInitialize()
returned error %d", eglGetError()); return false;}
if (!eglChooseConfig(display, attribs, &config, 1,
&numConfigs)) {debug("eglChooseConfig() returned error %d",
eglGetError()); destroyEGL(); return false;}
if (!eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID,
&format)) {debug("eglGetConfigAttrib() returned error %d",
eglGetError()); destroyEGL(); return false;}
int ret = ANativeWindow_setBuffersGeometry(window, 0, 0, format);
debug("format: %d, display: %d, config: %d, nconf: %d, ret:
%d",format, display,config,numConfigs, ret);
if (!(surface = eglCreateWindowSurface(display, config, window,
0))) {debug("eglCreateWindowSurface() returned error %d",
eglGetError()); destroyEGL(); return false;}
debug("display: %d, window: %d",display,window);
if (!(context = eglCreateContext(display, config, EGL_NO_CONTEXT,
context_attribs))) {debug("eglCreateContext() returned error %d",
eglGetError()); destroyEGL(); return false;}
if (!eglMakeCurrent(display, surface, surface,
context)) {debug("eglMakeCurrent() returned error %d",
eglGetError()); destroyEGL(); return false;}
if (!eglQuerySurface(display, surface, EGL_WIDTH, &width) || !
eglQuerySurface(display, surface, EGL_HEIGHT, &height))
{debug("eglQuerySurface() returned error %d", eglGetError());
destroyEGL(); return false;}
_display = display;
_surface = surface;
_context = context;
return setupGL(width,height);
}
This is the output in the Xperia:
format: 1, display: 1, config: 16, nconf: 1, ret: 0
display: 1, window: 2846880
And this is in the Tab2:
: format: 5, display: 1, config: 1, nconf: 1, ret: 0
: display: 1, window: 16193944
: eglCreateContext() returned error 12293
eglMakeCurrent:573 error 3008 (EGL_BAD_DISPLAY)
Error 12293 is EGL_BAD_CONFIG.
I know that Java ES 2 works fine on the galaxy tab 2 because i could
run some java samples on it.
Any help is greatly appreciated
guich