Hello. So, my goal is to create an OpenGL 3.3 context on MacOSX Mavericks with a NVIDIA GeForce 8600M card which, according to “https://developer.apple.com/graphicsimaging/opengl/capabilities/” should be possible.
Code:
SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 3 );
window = SDL_CreateWindow("Werner3D",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,WINDOW_WIDTH,WINDOW_HEIGHT,SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE);
glcontext = SDL_GL_CreateContext(window);
if (glcontext == 0) {
std::cout << "Error while creating OpenGL context: " << SDL_GetError() << endl;
abort();
}
std::cout << "OpenGL version" << glGetString(GL_VERSION) << endl;
Output: Error while creating OpenGL context: OpenGL > 3.2 is not supported on this platform
Ok, maybe the table is wrong, I try this code instead:
Code:
SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 );
SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 2 );
window = SDL_CreateWindow("Werner3D",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,WINDOW_WIDTH,WINDOW_HEIGHT,SDL_WINDOW_OPENGL|SDL_WINDOW_SHOWN|SDL_WINDOW_RESIZABLE);
glcontext = SDL_GL_CreateContext(window);
if (glcontext == 0) {
std::cout << "Error while creating OpenGL context: " << SDL_GetError() << endl;
abort();
}
std::cout << "OpenGL version" << glGetString(GL_VERSION) << endl;
Output: OpenGL version3.3 NVIDIA-8.18.27 310.40.05f01
3.3? It just told me that was not available! Could this be a bug of some kind?