O'Reilly logo

WebGL Beginner's Guide by Brandon Jones, Diego Cantor

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

Cube maps

Earlier in this chapter, we mentioned that aside from 2D textures the functions we've been discussing can also be used for cube maps. But what are cube maps and how do we use them?

A cube map is, very much like it sounds, a cube of textures. Six individual textures are created, each assigned to a different face of the cube. The graphics hardware can sample them as a single entity, using a 3D texture coordinate.

The faces of the cube are identified by the axis they face and whether they are on the positive or negative side of that axis.

Cube maps

Up until this point, any time we have manipulated a texture, we have specified a texture target of TEXTURE_2D ...

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