O'Reilly logo

WebGL Beginner's Guide by Brandon Jones, Diego Cantor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — creating an HTML5 canvas

  1. Using your favorite editor, create a web page with the following code in it:
    <!DOCTYPE html>
    <html>
    <head>
    <title> WebGL Beginner's Guide - Setting up the canvas </title>
    <style type="text/css">
    canvas {border: 2px dotted blue;}
    </style>
    </head>
    <body>
    <canvas id="canvas-element-id" width="800" height="600">
    Your browser does not support HTML5
    </canvas>
    </body>
    </html>
    

    Tip

    Downloading the example code

    You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

  2. Save the file as ch1_Canvas.html.
  3. Open it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required