-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_webgl_max_texture.html
More file actions
38 lines (33 loc) · 1.45 KB
/
test_webgl_max_texture.html
File metadata and controls
38 lines (33 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<title>WebGL Max Texture Size Test</title>
</head>
<body>
<h1>WebGL Max Texture Size Test</h1>
<div id="output"></div>
<script>
try {
const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
console.log('gl =', gl);
const outputDiv = document.getElementById('output');
if (!gl) {
outputDiv.innerHTML = '<p style="color: red;">WebGL context creation failed</p>';
throw new Error('WebGL context creation failed');
}
const maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
console.log('MAX_TEXTURE_SIZE =', maxTextureSize);
outputDiv.innerHTML = `
<p><strong>WebGL Context:</strong> ${gl ? 'Created successfully' : 'Failed'}</p>
<p><strong>MAX_TEXTURE_SIZE:</strong> ${maxTextureSize}</p>
<p><strong>WebGL Version:</strong> ${gl.getParameter(gl.VERSION)}</p>
<p><strong>Renderer:</strong> ${gl.getParameter(gl.RENDERER)}</p>
<p><strong>Vendor:</strong> ${gl.getParameter(gl.VENDOR)}</p>
`;
} catch (error) {
document.getElementById('output').innerHTML = `<p style="color: red;">Error: ${error.message}</p>`;
}
</script>
</body>
</html>