Select OpenGL profile in SDL 2.0

Is there any way to select core or compatibility OpenGL profile in SDL 2.0?
On my mac OpenGL Extensions Viewer detects “3.2 ATI-7.32.12” OpenGL version
for Core profile and “2.1 ATI-7.32.12” for Compatibility profile. But in my
app I’m always getting “2.1 ATI-7.32.12” from glGetString(GL_VERSION). So
it seems that SDL is initializing Compatibility profile by default. Any way
to force Core profile?

Regards, Alexey

Add this before you create your GL context:

Code:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);

Thanks, I tried it but it is still initializing 2.1 context. I’ve
investigated it deeper and found that Cocoa backend simply ignores
this attribute. And we need to add code to handle this to
Cocoa_GL_CreateContext() function located in SDL_cocoaopengl.m:

if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
attr[i++] = NSOpenGLPFAOpenGLProfile;
attr[i++] = kCGLOGLPVersion_3_2_Core;
}

How I can submit a patch? By the way why SDL is not hosted on
github\bitbucket where it is done very easily with pull request. Plus
you have integrated wiki, issue tracker etc?On Mon, Oct 1, 2012 at 11:56 AM, mbentrup <matthias.bentrup at googlemail.com> wrote:

Add this before you create your GL context:

Code:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Thanks, I tried it but it is still initializing 2.1 context. I’ve
investigated it deeper and found that Cocoa backend simply ignores
this attribute. And we need to add code to handle this to
Cocoa_GL_CreateContext() function located in SDL_cocoaopengl.m:

if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) {
attr[i++] = NSOpenGLPFAOpenGLProfile;
attr[i++] = kCGLOGLPVersion_3_2_Core;
}

You’re correct, I was just looking at this last week and hadn’t had a chance to fix it properly, but that’s the basic gist of the solution.

How I can submit a patch? By the way why SDL is not hosted on
github\bitbucket where it is done very easily with pull request.

Patches can go to http://bugzilla.libsdl.org/ … we can pull from bitbucket (or wherever), or you can use “hg export $REVNAME” and attach the output to the bugzilla entry, in which case it’ll eventually look like we pulled it from you.

Plus you have integrated wiki, issue tracker etc?

We have all those things, plus control over the servers.

http://wiki.libsdl.org/
http://bugzilla.libsdl.org/

–ryan.