We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 2301

Summary: Android SDL2 documentation / code mismatch: Getting wrong OpenGL ES context version
Product: SDL Reporter: Michael Labbé <mike>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: minor    
Priority: P2 CC: gabomdq
Version: 2.0.1   
Hardware: All   
OS: Android (All)   

Description Michael Labbé 2013-12-13 04:29:47 UTC
On Android, 

SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 2 ); 
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 0 );

must be called before initializing the GL context if you are programming the ES2 spec.  The documentation currently states:
SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION are used when creating an OpenGL 3.x context. 

... but says nothing about OpenGL ES.  

Proof:

glGetString( GL_VERSION ) returns "OpenGL ES-CM 1.1" and "OpenGL ES 2.0 14.01002", respectively, when the correct attributes are set on my tegra3 (ES2 compatible) hardware. 


In the source code:

SDL_egl.c:
SDL_EGL_CreateContext():

  if (_this->gl_config.major_version) {
        context_attrib_list[1] = _this->gl_config.major_version;
    }
Comment 1 Gabriel Jacobo 2013-12-13 13:02:49 UTC
Fixed the wiki, thanks!