I have tried setting the OpenGL context to v3.3 using the following code, it creates a 4.1 context.
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG);
Am I doing something wrong or is it a mac problem?
OpenGL does not provide any guarantees that when you ask for an OpenGL X.Y context, that you get exactly an OpenGL X.Y context. It depends on the drivers you use.
On OS X, if you ask for a core context, you get the highest version supported on your hardware and operating system combination. If you ask for a compatibility context, you get 2.1.
On my Linux/Mesa system, I always get 3.0 compatibility contexts, and 3.3 core contexts.
On my Windows/AMD system, I get the exactly the version I ask for.
The 4.1 context should work fine for you if your code assumes that the context is 3.3. Just check that the GL version is >= the version you need, and check that you have a compatibility context if you need it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With