Original Post
I would like to use two textures one the same quad. So I wrote a easy code that solved my problem. Anyway, this code uses two quads at the same size, one with the first texture, and the second with the other texture, and the second texture has partly a alpha-channal. It looks nice and the way I want it, but, would''nt it go faster if I used two textures on the same quad, instead of making two quads?
Here''s my code. Can someone make it better?
glEnable(GL_TEXTURE_2D);
glEnable(GL_ALPHA_TEST);
for (int a=0 ; a<2 ; a++)
{
glLoadIdentity();
glTranslatef(0.0f, 0.0f, -10.0f);
if (a==0) {
glBindTexture(GL_TEXTURE_2D, textur[0]);
glAlphaFunc(GL_ALWAYS, 0.0f);
}
if (a==1) {
glBindTexture(GL_TEXTURE_2D, textur[1]);
glAlphaFunc(GL_EQUAL, 1.0f);
}
glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 0.0f);
glEnd();
}