This JavaScript program demonstrates the shortest possible WebGL program. This program simply clears the canvas and paints it gray.
<!DOCTYPE html> <html> <head> <title>XoaX.net's WebGL</title> <script type="text/javascript"> function render() { var qCanvas = document.querySelector("#idWebGL"); var qGL = qCanvas.getContext("webgl"); qGL.clearColor(0.85, 0.85, 0.85, 1.0); qGL.clear(qGL.COLOR_BUFFER_BIT); } </script> </head> <body onload="render()"> <canvas id="idWebGL" width="400" height="400" style="border:1px black solid;"> </canvas> </body> </html>
© 20072024 XoaX.net LLC. All rights reserved.