i’m having a problem with alpha blending. i’m trying to have
a triangle blend from one texture to another. i set the
alpha channel of each vertex to a unique value, yet in the
end result the triangle is rendered like a static value has
been used for each of the triangle’s verticies’ alphas. i
can see that both textures were used on the triangle, but
there is no variance of the amount of each texture that was
used. =(
i’m using win98, and running opengl in software mode…
here’s the code=)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
glScalef(1.0f,-1.0f,1.0f);
glTranslatef(0.0f,1.0f,0.0f);
…
// more setup code
…
glBindTexture(GL_TEXTURE_2D,texture1_id);
glBegin(GL_TRIANGLES);
{
// left vertex
glTexCoord2f(.5f,0.0f);
glVertex3f(0, top, zdepth);
// right vertex
glTexCoord2f(0.0f,1.0f);
glVertex3f(left, bottom, zdepth);
// apex vertex
glTexCoord2f(1.0f,1.0f);
glVertex3f(right, bottom, zdepth);
}
glEnd();
glBindTexture(GL_TEXTURE_2D,texture2_id);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glDepthFunc(GL_EQUAL);
glBegin(GL_TRIANGLES);
{
// left vertex
glColor4f(1.0f, 1.0f, 1.0f, 0.0f);
glTexCoord2f(.5f,0.0f);
glVertex3f(0, top, zdepth);
// right vertex
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f,1.0f);
glVertex3f(left, bottom, zdepth);
// apex vertex
glColor4f(1.0f, 1.0f, 1.0f, 0.0f);
glTexCoord2f(1.0f,1.0f);
glVertex3f(right, bottom, zdepth);
}
glEnd();
glDepthFunc(GL_LESS);
glDisable(GL_BLEND);
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
thx for any help=)