151
Web Programming and Design / WebGL Browser support
« on: November 09, 2012, 09:24:51 pm »
Hey, I wanted to start and so some awesome stuff with WebGL but it looks as if my browser doesn't support it.
I have Chromium, this version: Version 22.0.1229.94 (161065) and i'm running on archlinux
my html code looks like this (from a tutorial to test if it's working):
I have Chromium, this version: Version 22.0.1229.94 (161065) and i'm running on archlinux
my html code looks like this (from a tutorial to test if it's working):
Code: [Select]
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function initWebGL(canvas) {
// Initialize the global variable gl to null.
gl = null;
try {
// Try to grab the standard context. If it fails, fallback to experimental.
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
}
catch(e) {}
// If we don't have a GL context, give up now
if (!gl) {
alert("Unable to initialize WebGL. Your browser may not support it.");
}
}
function doFirst() {
var canvas = document.getElementById("canvas");
initWebGL(canvas); // Initialize the GL context
// Only continue if WebGL is available and working
if (gl) {
gl.clearColor(0.0, 0.0, 0.0, 1.0); // Set clear color to black, fully opaque
gl.enable(gl.DEPTH_TEST); // Enable depth testing
gl.depthFunc(gl.LEQUAL); // Near things obscure far things
gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT); // Clear the color as well as the depth buffer.
}
}
window.addEventListener('load',doFirst,false);
</script>
</head>
<body onload="start()">
<canvas id="canvas" width="640" height="480">
Internet explorer SUCKS! :P
</canvas>
</body>
</html>