Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions src/Log4YM.Web/src/plugins/GlobePlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,35 +317,21 @@ export function GlobeCore({ hideOverlays, hideCompass }: { hideOverlays?: boolea
useEffect(() => {
if (!containerRef.current) return;

// Thorough WebGL check - test actual shader compilation.
// Quick WebGL availability check — only tests for context existence.
// The shader-compilation pre-check that was here produced false negatives on
// Windows (ANGLE backend) and Linux (Mesa) even when WebGL was fully functional,
// preventing the globe from loading on non-macOS platforms.
// globe.gl's own Three.js initialization handles deeper WebGL failures via the
// try/catch below.
try {
const testCanvas = document.createElement('canvas');
const gl2 = testCanvas.getContext('webgl2');
const gl: WebGLRenderingContext | null = gl2 ??
(testCanvas.getContext('webgl') ?? testCanvas.getContext('experimental-webgl') as WebGLRenderingContext | null);

const gl = testCanvas.getContext('webgl2') ?? testCanvas.getContext('webgl');
if (!gl) {
setWebglError('WebGL is not supported in your browser.');
return;
}

const vertexShader = gl.createShader(gl.VERTEX_SHADER);
if (!vertexShader) {
setWebglError('WebGL shader creation failed.');
return;
}

gl.shaderSource(vertexShader, 'void main() { gl_Position = vec4(0.0); }');
gl.compileShader(vertexShader);

if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
setWebglError('WebGL shader compilation failed.');
gl.deleteShader(vertexShader);
return;
}
gl.deleteShader(vertexShader);
} catch (e) {
setWebglError('Failed to initialize WebGL.');
setWebglError('WebGL is not available in this environment.');
return;
}

Expand Down
Loading