The shortest app in WebGL and JS

Published October 20, 2019
Advertisement

Filling a canvas with set color. It is one of the shortest web application in WebGL 1.0 and JavaScript. It set a clear color and fill the canvas with the color. You can run this applications in Playground (in Plunker), watch demo, read code, make Fork, write something, send a link to your friends: https://next.plnkr.co/edit/nGfFeDfD9WbGs1aS?open=index.html&preview

Plunker: https://next.plnkr.co/edit/nGfFeDfD9WbGs1aS?open=index.html&preview
CodePen: https://codepen.io/8Observer8/pen/VwwmxLd
JSFiddle: https://jsfiddle.net/8Observer8/akv6eh0o/
 


<!DOCTYPE html>
<html>
    <body>
        <canvas id="c" width="256" height="256"></canvas>
        <script>
            var canvas = document.getElementById('c');
            var gl = canvas.getContext('webgl');
            gl.clearColor(0.2, 0.5, 0.3, 1);
            gl.clear(gl.COLOR_BUFFER_BIT);
        </script>
    </body>
</html>

 

TheShortestWebGLApp_Screenshot.png

0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement