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 2206

Summary: GLES2 context creation fails in x11 since 2.0.1
Product: SDL Reporter: Carles Pagès <carles.pages>
Component: videoAssignee: Gabriel Jacobo <gabomdq>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.1   
Hardware: x86_64   
OS: Linux   
Attachments: Fixed test file

Description Carles Pagès 2013-11-03 16:21:38 UTC
Since SDL 2.0.1 gles2 context creation fails under x11.

I used the following code to reproduce the failure: http://sprunge.us/AJHe

I'm not sure if this is relevant, but this is on a laptop with an intel gm965 card.

I tracked down the change of behaviour to changeset 7659 (http://hg.libsdl.org/SDL/diff/ac4ce59c40e7/src/video/x11/SDL_x11opengl.c). Before, there was code to internally use the gles functions to create the context if SDL_GL_CONTEXT_EGL was set. Now, this decision is based on HAS_GLX_EXT_create_context_es2_profile, which is true in my system. So, X11_GL_CreateContext is used to try to create the gles context but it fails, specifically the last call to glXCreateContextAttribs returns null (with these attribs):
(gdb) print attribs
$4 = {8337, 2, 8338, 1, 37158, 4, 0, 0, 0}

I don't know how to further debug this, but a workaround would be to use again the gles internal functions to create the context when an 'es' context is needed.
Comment 1 Gabriel Jacobo 2013-11-04 12:51:18 UTC
Created attachment 1405 [details]
Fixed test file

Your test file fails here too. It's an easy fix though. See attached file.

(You didn't set the minor version for the context, and using SDL_GL_CONTEXT_EGL is deprecated).
Comment 2 Gabriel Jacobo 2013-11-04 12:51:43 UTC
Marking as invalid, feel free to reopen if this isn't the case.