The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Android OpenGL problems after 2.0.0 to 2.0.3 migration
D216


Joined: 02 Jun 2014
Posts: 7
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?
Android OpenGL problems after 2.0.0 to 2.0.3 migration
Alex Szpakowski
Guest

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:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
D216


Joined: 02 Jun 2014
Posts: 7
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/
Android OpenGL problems after 2.0.0 to 2.0.3 migration
gabomdq


Joined: 28 Jul 2011
Posts: 495
Location: Argentina
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:
Quote:
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:

Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org




_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





--
Gabriel.
D216


Joined: 02 Jun 2014
Posts: 7
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:
[code]
#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;
[/code]

And in 2.0.3 looks like:
[code]
#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;
[/code]

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.