In this chapter, we turn to WebGL, the version of OpenGL for the Web. Three.js, which was covered in the previous chapter, uses WebGL for 3D graphics. Of course, it is more difficult to use WebGL directly, but doing so gives you full control over the graphics hardware. And learning it will be a good introduction to modern graphics programming.
There have been many versions of OpenGL. WebGL 1.0 is based on OpenGL ES 2.0, a version designed for use on embedded systems such as smart phones and tablets. OpenGL ES 1.0 was very similar to OpenGL 1.1, which we studied in Chapter 3 and Chapter 4. However, the 2.0 version of OpenGL ES introduced major changes. It is actually a smaller, simpler API that puts more responsibility on the programmer. For example, functions for working with transformations, such as glRotatef and glPushMatrix, were eliminated from the API, making the programmer responsible for keeping track of transformations. WebGL does not use glBegin/glEnd to generate geometry, and it doesn’t use function such as glColor* or glNormal* to specify attributes of vertices. Nevertheless, it will turn out that much of what you learned in previous chapters will carry over to WebGL.