@@ -93,6 +93,21 @@ cdef class _WindowSDL3Storage:
9393 cdef SDL_Window * win
9494 cdef int _win_flags = self .win_flags
9595
96+ if multisamples:
97+ if self .sdl_manages_egl_context:
98+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1 )
99+ SDL_GL_SetAttribute(
100+ SDL_GL_MULTISAMPLESAMPLES, min (multisamples, 4 )
101+ )
102+ else :
103+ # Non-SDL GL context, so we can't set the multisample
104+ # attributes.
105+ return NULL
106+ else :
107+ if self .sdl_manages_egl_context:
108+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0 )
109+ SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0 )
110+
96111 if shaped:
97112 _win_flags |= SDL_WINDOW_TRANSPARENT
98113
@@ -150,6 +165,7 @@ cdef class _WindowSDL3Storage:
150165 config_alpha_size = Config.getint(' graphics' , ' alpha_size' )
151166 SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, config_alpha_size)
152167
168+ SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0 )
153169 SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1 )
154170
155171 SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2 )
@@ -211,9 +227,7 @@ cdef class _WindowSDL3Storage:
211227 SDL_HINT_OVERRIDE)
212228
213229 if SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0 :
214- logger.error(" WindowSDL: SDL_Init failed" )
215230 self .die()
216- print (" WindowSDL: SDL initialized with video and joystick support" )
217231
218232 # Set default orientation (force landscape for now)
219233 orientations = ' LandscapeLeft LandscapeRight'
@@ -254,12 +268,12 @@ cdef class _WindowSDL3Storage:
254268 # 3. Ordinary window with multisampling
255269 # 4. Ordinary window without multisampling
256270 sdl_window_configs = []
257- # if config_multisamples and config_shaped:
258- # sdl_window_configs.append((config_multisamples, config_shaped))
259- # if config_shaped:
260- # sdl_window_configs.append((0, config_shaped))
261- # if config_multisamples:
262- # sdl_window_configs.append((config_multisamples, 0))
271+ if config_multisamples and config_shaped:
272+ sdl_window_configs.append((config_multisamples, config_shaped))
273+ if config_shaped:
274+ sdl_window_configs.append((0 , config_shaped))
275+ if config_multisamples:
276+ sdl_window_configs.append((config_multisamples, 0 ))
263277 sdl_window_configs.append((0 , 0 ))
264278
265279 for multisamples, shaped in sdl_window_configs:
@@ -273,7 +287,6 @@ cdef class _WindowSDL3Storage:
273287 break
274288
275289 if not self .win:
276- logger.error(" WindowSDL: SDL_Init failed at end" )
277290 self .die()
278291
279292 # Set shape in case the user requested a shaped window and the window
0 commit comments