From 117622cd4ae4238bc00b60e8fbccdcc5c0baa724 Mon Sep 17 00:00:00 2001 From: nanahi <130121847+na-na-hi@users.noreply.github.com> Date: Tue, 2 Jan 2024 16:49:52 -0500 Subject: [PATCH] opengl/context_win: make --alpha=yes work Specify cAlphaBits in PIXELFORMATDESCRIPTOR makes the pixel format transparent, as is already the case for d3d11. Also makes the window transparent when --alpha=yes is used. Works on --vo=gpu and --vo=gpu-next. --- video/out/opengl/context_win.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/video/out/opengl/context_win.c b/video/out/opengl/context_win.c index 968b1763bf..17b1cb491a 100644 --- a/video/out/opengl/context_win.c +++ b/video/out/opengl/context_win.c @@ -96,6 +96,8 @@ static bool create_dc(struct ra_ctx *ctx) pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 24; + if (ctx->opts.want_alpha) + pfd.cAlphaBits = 8; pfd.iLayerType = PFD_MAIN_PLANE; int pf = ChoosePixelFormat(hdc, &pfd); @@ -293,6 +295,9 @@ static bool wgl_init(struct ra_ctx *ctx) if (!vo_w32_init(ctx->vo)) goto fail; + if (ctx->opts.want_alpha) + vo_w32_set_transparency(ctx->vo, ctx->opts.want_alpha); + vo_w32_run_on_thread(ctx->vo, create_ctx, ctx); if (!p->context) goto fail;