Chapter 3. Drawing and Transforming Triangles

Chapter 2, “Your First Step with WebGL,” explained the basic approach to drawing WebGL graphics. You saw how to retrieve the WebGL context and clear a <canvas> in preparation for drawing your 2D/3DCG. You then explored the roles and features of the vertex and fragment shaders and how to actually draw graphics with them. With this basic structure in mind, you then constructed several sample programs that drew simple shapes composed of points on the screen.

This chapter builds on those basics by exploring how to draw more complex shapes and how to manipulate those shapes in 3D space. In particular, this chapter looks at

• The critical role of triangles in 3DCG and WebGL’s support for drawing triangles ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.