Chapter 7. Toward the 3D World

In the previous chapters, we used examples based on 2D geometrical shapes to explain how the WebGL system works and how it supports the behavior of shaders, transformations such as translation and rotation, animation, and texture mapping. However, the techniques you’ve learned so far can be applied not only to 2D shapes but also to 3D objects. In this chapter you’ll take the first step into the 3D world and explore the implications of moving from 2D to 3D. In particular, you will explore:

• Representing the user’s view into the 3D world

• Controlling the volume of 3D space that is viewed

• Clipping

• Handling foreground and background objects

• Drawing a 3D object (a cube)

All these issues have a significant impact ...

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.