O'Reilly logo

WebGL Programming Guide: Interactive 3D Graphics Programming with WebGL by Rodger Lea, Kouichi Matsuda

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

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 ...

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