I’m one of the developers for Pioneer [1], 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
platform?
It looks to me like the GL attributes are involved at window creation
time at least on Win32 (see WIN_GL_SetupWindow in [2], which is called
from WIN_CreateWindow in [3]), 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?
Thanks,
John B
[1] http://pioneerspacesim.net/
[2] http://hg.libsdl.org/SDL/file/6b3cc8b7c589/src/video/windows/SDL_windowsopengl.c
[3] http://hg.libsdl.org/SDL/file/6b3cc8b7c589/src/video/windows/SDL_windowswindow.c