OpenGL 1.1 context creation failure

Hello guys

I’m having some sort of issue with the SDL 2.0.3 during OpenGL context creation. In fact personally I do not have any issues, but I do have few users who are experiencing this specific error.

My OpenGL context creation looks like this:

Code:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 3);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 3);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 2);
SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 0);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0);

SDL_DisplayMode displayMode;
if(SDL_GetDisplayMode(0, 0, &displayMode) != 0)
    g_logger.fatal(stdext::format("Failed to get display mode!\n%s", SDL_GetError()));

// find out whether pixel format supports alpha bits
if(SDL_ISPIXELFORMAT_ALPHA(displayMode.format) || SDL_BYTESPERPIXEL(displayMode.format) == 4)
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 1);

// create window
m_window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, m_size.width(), m_size.height(), SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE);
if(m_window == NULL)
    g_logger.fatal(stdext::format("Failed to create window!\n%s", SDL_GetError()));

// create OpenGL context
m_context = SDL_GL_CreateContext(m_window);
if(m_context == NULL)
    g_logger.fatal(stdext::format("Failed to create OpenGL context!\n%s", SDL_GetError()));

As you can see I’m requesting at least 3/3/2 pixel format and one alpha bit if pixel format has alpha channel and nothing besides that. However, I have currently two users experiencing following issue on their computers:

[Image: http://i.imgur.com/imJEIV3.png ]

I told them to use GLView to find out more about their OpenGL and graphics card. Here is what I’ve got:

User with Geforce 7300 SE:

As you can see it supports core 1.1 just fine.

Also, another User with Geforce 9300M:
Imgur

As far as I know they have up to date graphics driver. As far as I can tell everything is just fine, all of those graphics card should be capable of creating the context just fine. It’s worth noticing that those strange symbols in error message comes from SDL itself.

I did update SDL to 2.0.4 from hg. Shortly after that following commit was made:

73 minutes ago Ryan C. Gordon Make some string literals “const char *”, not “char *” (thanks, Martin!).

However, it does not contain any critical changes so we can assume it’s still the same.

Program still fails to create OpenGL context with newest SDL of 2.0.4 as well. Same error as with 2.0.3.

Actually there is no such thing as Core Profile OpenGL 1.1. The concept of Core Profiles was introduced in OpenGL 3, and requesting a Core Profile context on Windows can usually only be done with functionality included in drivers that also support OpenGL 3, so your use of that flag might be causing issues.> On Jun 12, 2015, at 2:19 PM, .3lite wrote:

I did update SDL to 2.0.4 from hg. Shortly after that following commit was made:

73 minutes ago Ryan C. Gordon Make some string literals “const char *”, not “char *” (thanks, Martin!).

However, it does not contain any critical changes so we can assume it’s still the same.

Program still fails to create OpenGL context with newest SDL of 2.0.4 as well. Same error as with 2.0.3.


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

I would second that. You can only get a core profile when you request GL
3.2 - 3.3. The core profile distinction does not exist in any other
version of OpenGL. The best thing to do is to attempt to get a GL 3 core
profile if you need it, then try again after disabling the core profile
flag:
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0);

Jonny DOn Fri, Jun 12, 2015 at 1:27 PM, Alex Szpakowski wrote:

Actually there is no such thing as Core Profile OpenGL 1.1. The concept of
Core Profiles was introduced in OpenGL 3, and requesting a Core Profile
context on Windows can usually only be done with functionality included in
drivers that also support OpenGL 3, so your use of that flag might be
causing issues.

On Jun 12, 2015, at 2:19 PM, .3lite wrote:

I did update SDL to 2.0.4 from hg. Shortly after that following commit was
made:

73 minutes ago Ryan C. Gordon Make some string literals “const char *”,
not “char *” (thanks, Martin!).

However, it does not contain any critical changes so we can assume it’s
still the same.

Program still fails to create OpenGL context with newest SDL of 2.0.4 as
well. Same error as with 2.0.3.


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


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

I believe you were right guys, thank you for that. One user confirmed that he can launch the application after I did set SDL_GL_CONTEXT_PROFILE_MASK to 0. I do not need any features of OpenGL 3.x so I guess setting mask to 0 is the right way in my case.

Thank you again.

As a side note, shouldn’t the error message be more specific rather than bunch of strange symbols?