From f6ce7176b2e32d33a373f29f8d1c4516089d41fe Mon Sep 17 00:00:00 2001 From: Asger Finding Date: Wed, 28 Oct 2026 15:30:49 +0100 Subject: [PATCH] Add GameConfig.antialiasGL --- CHANGELOG.md | 10 ++++++++++ src/core/Game.js | 1 + src/pixi/renderers/webgl/WebGLRenderer.js | 2 +- typescript/phaser.d.ts | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48001f36a..69941ed7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## Unreleased + +### New Features + +- The game config now has an `antialiasGL` option for the WebGL context's `antialias` attribute, separate from texture smoothing. + +### Thanks + +@asger-finding + ## Version 2.21.0 - 23 October 2026 ### New Features diff --git a/src/core/Game.js b/src/core/Game.js index 5688d8e41..ea270035d 100644 --- a/src/core/Game.js +++ b/src/core/Game.js @@ -564,6 +564,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant * @property {boolean} [GameConfig.alignH=false] - Sets {@link Phaser.ScaleManager#pageAlignHorizontally}. * @property {boolean} [GameConfig.alignV=false] - Sets {@link Phaser.ScaleManager#pageAlignVertically}. * @property {boolean} [GameConfig.antialias=true] + * @property {boolean} [GameConfig.antialiasGL] - Sets the WebGL context's `antialias` attribute separately from texture smoothing. Defaults to `antialias`. * @property {number|string} [GameConfig.backgroundColor=0] - Sets {@link Phaser.Stage#backgroundColor}. * @property {HTMLCanvasElement} [GameConfig.canvas] - An existing canvas to display the game in. * @property {string} [GameConfig.canvasID] - `id` attribute value to assign to the game canvas. diff --git a/src/pixi/renderers/webgl/WebGLRenderer.js b/src/pixi/renderers/webgl/WebGLRenderer.js index 97dcff4d3..3c84a8bb5 100644 --- a/src/pixi/renderers/webgl/WebGLRenderer.js +++ b/src/pixi/renderers/webgl/WebGLRenderer.js @@ -117,7 +117,7 @@ PIXI.WebGLRenderer = function (game, config) */ this._contextOptions = { alpha: this.transparent, - antialias: game.antialias, + antialias: (config.antialiasGL === undefined) ? game.antialias : config.antialiasGL, failIfMajorPerformanceCaveat: config.failIfMajorPerformanceCaveat, premultipliedAlpha: this.transparent && this.transparent !== 'notMultiplied', stencil: true, diff --git a/typescript/phaser.d.ts b/typescript/phaser.d.ts index 3b6c9ee0a..1a819ad4a 100644 --- a/typescript/phaser.d.ts +++ b/typescript/phaser.d.ts @@ -1474,6 +1474,7 @@ declare module Phaser { alignH?: boolean; alignV?: boolean; antialias?: boolean; + antialiasGL?: boolean; backgroundColor?: number | string; canvas?: HTMLCanvasElement; canvasId?: string;