From 9efd160bbd5a72e69b492476f704e537abb7187a Mon Sep 17 00:00:00 2001 From: Darren Eberly Date: Sat, 27 Dec 2025 14:47:19 -0500 Subject: [PATCH] Disable WebGL alpha channel --- arcade/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arcade/__init__.py b/arcade/__init__.py index dbf9f2bad..5eb81256b 100644 --- a/arcade/__init__.py +++ b/arcade/__init__.py @@ -63,6 +63,12 @@ def configure_logging(level: int | None = None): else: pyglet.options.dpi_scaling = "stretch" +# WebGL has an alpha channel in the backing buffer by default that is +# 0.0 unless you explicitly clear the alpha channel to 1.0. Disabling +# this channel causes it to behave more in line with how full OpenGL works. +if sys.platform == "emscripten": + pyglet.options.pyodide.context_options["alpha"] = False + # Env variable shortcut for headless mode headless: Final[bool] = bool(os.environ.get("ARCADE_HEADLESS")) if headless: