- In the initialization section of your OpenGL program, load the two images into texture memory in the same way as indicated in the previous recipe, Applying a 2D texture. Make sure that the brick texture is loaded into texture unit 0 and the moss texture in texture unit 1:
GLuint brick = Texture::loadTexture("brick1.jpg"); GLuint moss = Texture::loadTexture("moss.png");// Load brick texture file into channel 0glActiveTexture(GL_TEXTURE0);glBindTexture(GL_TEXTURE_2D, brick);// Load moss texture file into channel 1glActiveTexture(GL_TEXTURE1);glBindTexture(GL_TEXTURE_2D, moss);
- Starting with the fragment shader from the recipe Applying a 2D texture, replace the declaration of the sampler variable Tex1 with the following ...