Hi all,
I have two textures, while texture0 has no alpha channel(RGB 565), and texture1 has alpha channel (RGBA8888), i export&load them via pvr format.
so the final rgb = texture0.rgb + (texture1.rgb * texture1.alpha). //and there is no need to blend with background color
I am new to opengl es, and i found glTexEnv(xxx) is so hard to understand and use…
I’ve tried code in “OGLES-1.1_WINDOWS_PCEMULATION_2.03.23.1162\TrainingCourse\10_Multitexture”, but the result looks strange, here is my code:
glDisable(GL_BLEND);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_ui32Ground);
// Set up the Second Texture
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, m_ui32WallForeground);//m_ui32WallForeground
/**/
// Set the texture environment mode for this texture to combine
myglTexEnv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
// Set the method we're going to combine the two textures by.
myglTexEnv(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);//GL_MODULATE
// Use the previous combine texture as source 0
myglTexEnv(GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_TEXTURE);
// Use the current texture as source 1
myglTexEnv(GL_TEXTURE_ENV, GL_SOURCE1_RGB, GL_PREVIOUS);
//Set what we will operate on, in this case we are going to use
//just the texture colours.
myglTexEnv(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
myglTexEnv(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_DST_ALPHA);
// Indexed Triangle list
glDrawElements(GL_TRIANGLES, Mesh.nNumFaces * 3, GL_UNSIGNED_SHORT, (unsigned short*)Mesh.sFaces.pData);
Please help me…