Android OpenGL problems after 2.0.0 to 2.0.3 migration

Hello!

I have a project that runs almost fine on android using SDL 2.0.0. I decided to switch to current 2.0.3 release to fix some problems. But I got new:
On 2.0.3 glEnable(GL_COLOR_MATERIAL) and glEnable(GL_TEXTURE_2D) resulting with glGetError 1280 (GL_INVALID_ENUM). On 2.0.0 same code working correctly.

What should I do now? Is there a way to investigate a problem? Where to should I take a look now?

Which OpenGL ES version are you specifying with SDL_GL_SetAttribute before creating the window/context? Those enums are only valid in GLES 1.1, and I believe SDL defaults to GLES 2 on Android if you don?t tell it otherwise.On Jul 9, 2014, at 3:26 PM, D216 wrote:

Hello!

I have a project that runs almost fine on android using SDL 2.0.0. I decided to switch to current 2.0.3 release to fix some problems. But I got new:
On 2.0.3 glEnable(GL_COLOR_MATERIAL) and glEnable(GL_TEXTURE_2D) resulting with glGetError 1280 (GL_INVALID_ENUM). On 2.0.0 same code working correctly.

What should I do now? Is there a way to investigate a problem? Where to should I take a look now?


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

Forgot ot say: code is huge, so posting it is useless. If you want to take a look, it is here: https://sourceforge.net/p/caphd/code/ci/master/tree/jni/src/

Looking at your code, you are not selecting the OpenGL ES version you want,
so SDL selects the default for the platform. I honestly don’t recall if
this default changed from 2.0.0 to 2.0.3, but it looks like this could be
the case.
If you want to use GL ES 1, you need to
set SDL_GL_CONTEXT_MAJOR_VERSION, SDL_GL_CONTEXT_MINOR_VERSION
and SDL_GL_CONTEXT_PROFILE_MASK (See:
https://wiki.libsdl.org/SDL_GL_SetAttribute)

2014-07-09 15:28 GMT-03:00 Alex Szpakowski :> Which OpenGL ES version are you specifying with SDL_GL_SetAttribute before

creating the window/context? Those enums are only valid in GLES 1.1, and I
believe SDL defaults to GLES 2 on Android if you don?t tell it otherwise.

On Jul 9, 2014, at 3:26 PM, D216 wrote:

Hello!

I have a project that runs almost fine on android using SDL 2.0.0. I
decided to switch to current 2.0.3 release to fix some problems. But I got
new:
On 2.0.3 glEnable(GL_COLOR_MATERIAL) and glEnable(GL_TEXTURE_2D) resulting
with glGetError 1280 (GL_INVALID_ENUM). On 2.0.0 same code working
correctly.

What should I do now? Is there a way to investigate a problem? Where to
should I take a look now?


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


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


Gabriel.

Oh, thank You very much, guys! Your answers are absolutely correct. I just added two strings to set proper gl context version and it started working. Thanks alot!

After confirmation of solution I went deeper to find out a reason of my problem. I believe the problem is in SDL_video.c file, function SDL_VideoInit.
There is a piece of code, that in 2.0.0 looks like:

#if SDL_VIDEO_OPENGL
    _this->gl_config.major_version = 2;
    _this->gl_config.minor_version = 1;
    _this->gl_config.use_egl = 0;
#elif SDL_VIDEO_OPENGL_ES
    _this->gl_config.major_version = 1;
    _this->gl_config.minor_version = 1;
    _this->gl_config.use_egl = 1;
#elif SDL_VIDEO_OPENGL_ES2
    _this->gl_config.major_version = 2;
    _this->gl_config.minor_version = 0;
    _this->gl_config.use_egl = 1;

And in 2.0.3 looks like:

#if SDL_VIDEO_OPENGL
    _this->gl_config.major_version = 2;
    _this->gl_config.minor_version = 1;
#elif SDL_VIDEO_OPENGL_ES2
    _this->gl_config.major_version = 2;
    _this->gl_config.minor_version = 0;
    _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;
#elif SDL_VIDEO_OPENGL_ES
    _this->gl_config.major_version = 1;
    _this->gl_config.minor_version = 1;
    _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES;

So the priority of ES versions has been changed.
Also, 2.0.0 even doesn’t define SDL_VIDEO_OPENGL_ES2 in its SDL_config_android.h, while 2.0.3 does.