I’m using the following combiner function:
static GLfloat constColor[4];
constColor[0] = 0.;//material->diffuse[0];
constColor[1] = 0.;//material->diffuse[1];
constColor[2] = 0.;//material->diffuse[2];
constColor[3] = material->m_TexTransparency;
glTexEnvfv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_COLOR,constColor);
//can't figure out how to not wipe out a fragment's alpha by the
//incoming texture unit alpha. for now, allow this mode in order
//to decal 2D text onto a 3DObject. N.B. in order to do this
//the 2D text has to be 'Texture 1'
if(i==0 && m_pModel->materials[group->material].m_bColorIsUsed)
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_DECAL);
else
{
glTexEnvf(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV,GL_COMBINE_RGB, GL_INTERPOLATE);
glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE0_RGB,GL_TEXTURE);
glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND0_RGB,GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE1_RGB,GL_PREVIOUS);
glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND1_RGB,GL_SRC_COLOR);
glTexEnvf(GL_TEXTURE_ENV,GL_SOURCE2_RGB,GL_CONSTANT);
glTexEnvf(GL_TEXTURE_ENV,GL_OPERAND2_RGB,GL_SRC_ALPHA);
this is basically straight out of the red book.
well, here’s what sucks: the last operands perform a weighted blending of texture and previous fragment color. Suppose I set my texture to be fully opaque, all I get for the texel color in that case is the texture color, lighting seems to have no bearing on it at all. How do I get multitexturing working with lighting properly?
Is there a way to do this without resorting to fragment programs?
If this doesn’t belong in beginner forum sorry, the advanced one is closed down.
[This message has been edited by Aeluned (edited 03-11-2004).]