O'Reilly logo

OpenGL Programming Guide: The Official Guide to Learning OpenGL, Version 4.3, Eighth Edition by Bill M. Licea-Kane, John M. Kessenich, Graham Sellers, Dave Shreiner

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

Using Multiple Textures

Now that you have seen a simple application of texture to rendering, you may have noticed some omissions from the sample above. For example, in Example 6.9, we did not set a value for the sampler in the fragment shader. This is because we are only using a single texture. In fact, OpenGL can support many textures simultaneously—a minimum of 16 textures per shader stage are supported, which when multiplied by the number of shader stages supported by OpenGL comes out to 80 textures! In fact, OpenGL has 80 texture units, referred to by tokens named GL_TEXTURE0 through GL_TEXTURE79. Whenever one of the texture functions, such as glBindTexture() is called, it operates on the texture bound to the active texture unit, which is ...

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