"Starting up OpenGL ES 0.1" on Android?

When creating a GL context on Android via SDL2, via LogCat I see that SDL says “Starting up OpenGL ES 0.1”. The next thing from SDL is an error message stating “No EGL config available.” This is obviously because SDL passed a bad version to EGL when creating the context. SDL doesn’t seem to be setting the SDLActivity.mGLMajor/SDLActivity.mGLMinor version numbers correctly. I tried to force the issue with the following lines, but to no avail:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 0);

If I hardcode the major version number to 2 in SDLActivity.java as follows, it opens a context fine:

public static boolean createEGLContext() { EGL10 egl = (EGL10) EGLContext.getEGL(); int EGL_CONTEXT_CLIENT_VERSION = 0x3098; [b]int contextAttrs[] = new int[] { EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };[/b] SDLActivity.mEGLContext = egl.eglCreateContext(SDLActivity.mEGLDisplay, SDLActivity.mEGLConfig, EGL10.EGL_NO_CONTEXT, contextAttrs); if (SDLActivity.mEGLContext == EGL10.EGL_NO_CONTEXT) { Log.e("SDL", "Couldn't create context"); return false; } return true; }

I updated my SDL source to the latest on hg as of today, and the problem persists. Any ideas? Thanks in advance.

If the problem is solved by editing SDLActivity.java to suit your needs, why is that even a problem??

I don’t thing SDL does not allow you to use your own configuration editing exisiting configuration files.

jlev31415 wrote:> When creating a GL context on Android via SDL2, via LogCat I see that SDL says “Starting up OpenGL ES 0.1”. The next thing from SDL is an error message stating “No EGL config available.” This is obviously because SDL passed a bad version to EGL when creating the context. SDL doesn’t seem to be setting the SDLActivity.mGLMajor/SDLActivity.mGLMinor version numbers correctly. I tried to force the issue with the following lines, but to no avail:

Code:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 0);

If I hardcode the major version number to 2 in SDLActivity.java as follows, it opens a context fine:

Code:
public static boolean createEGLContext() {
EGL10 egl = (EGL10) EGLContext.getEGL();
int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
int contextAttrs[] = new int[] { EGL_CONTEXT_CLIENT_VERSION,
2, EGL10.EGL_NONE };

SDLActivity.mEGLContext = egl.eglCreateContext(SDLActivity.mEGLDisplay,
SDLActivity.mEGLConfig, EGL10.EGL_NO_CONTEXT, contextAttrs);
if (SDLActivity.mEGLContext == EGL10.EGL_NO_CONTEXT) {
Log.e(“SDL”, “Couldn’t create context”);
return false;
}
return true;
}

I updated my SDL source to the latest on hg as of today, and the problem persists. Any ideas? Thanks in advance.


C is the God’s Programming Language

neoaggelos wrote:

If the problem is solved by editing SDLActivity.java to suit your needs, why is that even a problem??

I believe it may be a problem because SDL does not seem to be properly detecting the available version of OpenGL ES.

neoaggelos wrote:

I don’t thing SDL does not allow you to use your own configuration editing exisiting configuration files.

I do not understand what you’re trying to say here.

2013/7/14 jlev31415

**
When creating a GL context on Android via SDL2, via LogCat I see that SDL
says “Starting up OpenGL ES 0.1”. The next thing from SDL is an error
message stating “No EGL config available.” This is obviously because SDL
passed a bad version to EGL when creating the context. SDL doesn’t seem to
be setting the SDLActivity.mGLMajor/SDLActivity.mGLMinor version numbers
correctly. I tried to force the issue with the following lines, but to no
avail:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 0);

If I hardcode the major version number to 2 in SDLActivity.java as
follows, it opens a context fine:

If you pasted this code directly from your app, you are setting
SDL_GL_CONTEXT_MAJOR_VERSION to 0, which is what causes problems (you
probably wanted to set MINOR in the third line).
Anyway, it’s probably best if SDL prevents you from shooting yourself in
the foot like this :slight_smile:

Gabriel, Thank you for the reply. You were correct - I accidentally copy/pasted that line twice. Your keen eye has helped me fix my issue when debugging on actual Android devices. However, the original problem which started me down this path still persists:

When trying to debug my app using the Android emulator, I get an error message from SDL stating “No EGL config available,” and my shaders fail to load. I have “Use Host GPU” checked in my AVD settings. Any idea what might cause this?

2013/7/30 jlev31415

**
Gabriel, Thank you for the reply. You were correct - I accidentally
copy/pasted that line twice. Your keen eye has helped me fix my issue when
debugging on actual Android devices. However, the original problem which
started me down this path still persists:

When trying to debug my app using the Android emulator, I get an error
message from SDL stating “No EGL config available,” and my shaders fail to
load. I have “Use Host GPU” checked in my AVD settings. Any idea what might
cause this?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I know not all Android images in the emulator have support for OpenGL ES 2
(I think you need Android >=4), so I would try different versions of the
Android image (newer versions if you haven’t done so already) and maybe try
a OpenGL ES 1.1 context to see if at least that gets created.–
Gabriel.