SDL: SDL_GL_ALPHA_SIZE not working how expected

On systems with compositors, I’d expect a window configured with SDL_GL_ALPHA_SIZE as anything but 0 to allow one to draw windows with transparency, e.g custom window borders with borderless SDL window and custom hit test function. However it seems SDL always presents such windows as opaque (on X11 and Wayland). This is something supported by GLFW, Qt, FreeGLUT, and even SFML so I’m wondering if I’m just doing something wrong, if there’s some undocumented feature of the API I’m unaware of. I know you can set whole-window transparency but that’s not what I’m looking for. The use case is to do client-side window frames and drop shadows, which means I need them to alpha-blend against the desktop and other windows. I also experimented with custom VisualIDs via HINT_VIDEO_X11_WINDOW_VISUALID (in the case of X11) to no avail. Looking at the created visual it appears to have type XRGB8888 so the alpha channel is there, it’s just not being presented as such.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

let’s close this, since #7319 is merged

@graphitemaster: you can check this PR that adds transparency https://github.com/libsdl-org/SDL/pull/7319

@myo: you can check this PR that adds transparency https://github.com/libsdl-org/SDL/pull/7319