Jump to content
  • Advertisement

The shortest app in WebGL and JS

8Observer8

1095 views

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 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!