Imagination PowerVR SDK Blog

Questions regarding multi-texture excercise


#1

In OGLESMultiTexture, the following code is used to set up the combiners for bumpmapping:





     glActiveTexture(GL_TEXTURE0);


     glBindTexture(GL_TEXTURE_2D, m_ui32Stampnm);





     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);


     glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB);


     glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);


     glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);





     // Set up the Second Texture and combine it with the result of the Dot3 combination





     


        glActiveTexture(GL_TEXTURE1);


     glBindTexture(GL_TEXTURE_2D, m_ui32Crate);





Is not the following code equivalent to merely using:


     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);





     // Set the texture environment mode for this texture to combine


     glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);





     // Set the method we’re going to combine the two textures by.


     glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);





Isn’t the use of GL_TEXTURE in the following line, for the current selected TU, in this case, GL_TEXTURE1?





Seems like it should be: glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_TEXTURE);





     // Use the previous combine texture as source 0


     glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);





     // Use the current texture as source 1


     glTexEnvf(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);