The multitexturing allows you to apply more than one texture on a given geometry to produce many interesting results; modern graphics allow you to apply multiple textures on to geometry by means of texture units. In this recipe, you will learn how to make use of multiple texture units in order to implement multitexturing.
This recipe is similar to our first recipe, that is, SimpleTexture
. The only difference is that we will use more than one texture. Instead of using the 2D plane geometry, we will use a 3D cube. Additionally, there are some changes required in the fragment shader. We will discuss this in the next section.
This section will discuss all the important changes made to support multiple textures:
Modify the fragment shader to support two given textures simultaneously; these two textures are referenced using the
TexFragile
andTexwood
handles:#version 300 es precision mediump float; in vec2 TexCoord; uniform sampler2D TexFragile...