diff --git a/src/client/graphics/layers/StructureDrawingUtils.ts b/src/client/graphics/layers/StructureDrawingUtils.ts index 9c3eb6ce5..1ccad7c2f 100644 --- a/src/client/graphics/layers/StructureDrawingUtils.ts +++ b/src/client/graphics/layers/StructureDrawingUtils.ts @@ -89,6 +89,10 @@ export class SpriteFactory { unitType: UnitType, ) { const image = new Image(); + // crossOrigin must be set before src so the fetch is CORS-checked. + // Without this, an icon served from CDN_BASE taints structureCanvas + // and PIXI.Texture.from rejects the upload to WebGL. + image.crossOrigin = "anonymous"; image.src = unitInfo.iconPath; image.onload = () => { unitInfo.image = image; diff --git a/src/client/graphics/layers/StructureLayer.ts b/src/client/graphics/layers/StructureLayer.ts index 5bc165b92..f26a7dfbd 100644 --- a/src/client/graphics/layers/StructureLayer.ts +++ b/src/client/graphics/layers/StructureLayer.ts @@ -87,6 +87,10 @@ export class StructureLayer implements Layer { private loadIcon(unitType: string, config: UnitRenderConfig) { const image = new Image(); + // crossOrigin must be set before src so the fetch is CORS-checked. + // Without this, an icon served from CDN_BASE taints any canvas/texture + // it's drawn into, and WebGL refuses to upload it via texImage2D. + image.crossOrigin = "anonymous"; image.src = config.icon; image.onload = () => { this.unitIcons.set(unitType, image);