I’m one of the developers for Pioneer , which has recently switched
from SDL 1.2 to SDL 2.
In our SDL 1.2 initialisation code, we first try to SetVideoMode with
a multisampled backbuffer, and if this fails we turn multisampling off
with SDL_GL_SetAttribute and try again. This works fine – if
multisampling is supported then we get it, otherwise we don’t.
However, with SDL 2, there are two steps, create a window, and then
create a GL context, which raises a question:
Is it correct to reuse the same window after changing GL attributes?
Or do (some) GL attributes affect window creation too, on any
It looks to me like the GL attributes are involved at window creation
time at least on Win32 (see WIN_GL_SetupWindow in , which is called
from WIN_CreateWindow in ), but I would appreciate a confirmation
that this understanding is correct and matches the intended behaviour
of the API. If this is correct, then I assume that to implement the
fallback we must:
- setup GL attributes
- create window
- create context
- if window or context creation failed: destroy window, setup
fallback GL attributes, and repeat steps 2 & 3.
Unless perhaps there is a way to detect multisampling support before
we create the window & context in the first place?