Chapter 2. Your First Step with WebGL

As explained in Chapter 1, “Overview of WebGL,” WebGL applications use both HTML and JavaScript to create and draw 3D graphics on the screen. To do this, WebGL utilizes the new <canvas> element, introduced in HTML5, which defines a drawing area on a web page. Without WebGL, the <canvas> element only allows you to draw two-dimensional graphics using JavaScript. With WebGL, you can use the same element for drawing three-dimensional graphics.

This chapter explains the <canvas> element and the core functions of WebGL by taking you, step-by-step, through the construction of several example programs. Each example is written in JavaScript and uses WebGL to display and interact with a simple shape on a web page. ...

Get WebGL Programming Guide: Interactive 3D Graphics Programming with WebGL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.