The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
[SOLVED] OpenGL 3.2 / SDL 1.3 with OS X Lion
Boouh


Joined: 25 Jul 2011
Posts: 9
Oh so it can't recognize OS X Lion and use the right Core Profile. I saw a file in SDL sources (SDL_render_gl.c) which contains GLSL code, is this file that manages the Shaders ?
OpenGL 3.2 / SDL 1.3 with OS X Lion
nodag


Joined: 24 Jul 2011
Posts: 2
I think it's highly likely that SDL 1.3 does not properly 'support' Lion at the moment. To activate the core profile in Lion one has to call some CGL functions defined in OpenGL.h which is probably not the case right now. I'm looking forward to it, though, and hope that it is properly include as soon as possible.
OpenGL 3.2 / SDL 1.3 with OS X Lion
Boouh


Joined: 25 Jul 2011
Posts: 9
Is there any news ?
Boouh


Joined: 25 Jul 2011
Posts: 9
Good new the problem is resolved ! Very Happy

I just found the solution by using Cocoa to create an OpenGL 3.2 context. I have noticed that with Cocoa, we were obliged to use Vertex Array Objects (VAO) and Vertex Buffer Objects (VBO) to draw something on the screen. I tried to use them with SDL Framework and it didn't work at first. In fact, the SDL (for Mac) doesn't handle few attributes properly. We need to use two attributes to enable the 3.2 profile : SDL_GL_CONTEXT_MAJOR_VERSION and SDL_GL_CONTEXT_MINOR_VERSION.

To use them, I added this code in the SDL code (file : src/video/cocoa/SDL_cocoaopengl.m, function : SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window)) :

Code:

if(_this->gl_config.major_version == 3 && _this->gl_config.minor_version == 2)   
{   
    attr[i++] = NSOpenGLPFAOpenGLProfile;
    attr[i++] = NSOpenGLProfileVersion3_2Core;
}


I don't know how to submit a patch to SDL repository but this code enables Mac Users to use OpenGL 3.2 with SDL (Don't forget to use VAO and VBO in your code). Smile
cleure


Joined: 07 Nov 2011
Posts: 2
Location: Tacoma, WA
Your patch will likely break on all other versions of OSX. You need to wrap the "if (_this...)" code inside of an "#ifdef MAC_OS_X_VERSION_10_7", because the constants used aren't available in older versions of OSX.

I've been working on getting SDL 1.3 + OpenGL 3.2 working in Lion in my spare time for the past week, and unfortunately it seems that is just one of the road blocks preventing SDL 1.3 from working properly with OpenGL 3.2. My OpenGL test code works in the native API, but completely breaks with SDL.