Android OpenGL problems after 2.0.0 to 2.0.3 migration |
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:
|
|||||||||||||
|
D216
|
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
|
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:
-- Gabriel. |
|||||||||||||||
|
D216
|
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. |
|||||||||||
|