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 - Android SDL2 documentation / code mismatch: Getting wrong OpenGL ES context version
Summary: Android SDL2 documentation / code mismatch: Getting wrong OpenGL ES context v...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.1
Hardware: All Android (All)
: P2 minor
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-13 04:29 UTC by Michael Labbé
Modified: 2013-12-13 13:02 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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!