A color state fix

Something that I forgot in the shader definition
This commit is contained in:
cholleme 2003-06-29 21:51:04 +00:00
parent fc57654f92
commit 0398c8fc2d
3 changed files with 38 additions and 4 deletions

View file

@ -421,14 +421,14 @@ static char bump_fragment_program[] =
"TEMP diffdot, specdot, selfshadow, temp\n;"
"TEX normalmap, tex0, texture[0], 2D;\n"
"MAD normalmap.rgb, normalmap, scaler.b, scaler.a;\n"
"DP3 temp.x, tex1, tex1;\n"
"DP3 temp.x, tex1, tex1;\n" //normalize to light ("real normalize" no cubemaps)
"RSQ temp.x, temp.x;\n"
"MUL lightvec, temp.x, tex1;\n"
"DP3 temp.x, tex2, tex2;\n"
"DP3 temp.x, tex2, tex2;\n" //normalize to light ("real normalize" no cubemaps)
"RSQ temp.x, temp.x;\n"
"MUL halfvec, temp.x, tex2;\n"
"TEX colormap, tex0, texture[1], 2D;\n"
"TEX atten, tex3, texture[2], 3D;\n"
"TEX atten, tex3, texture[2], 3D;\n" //get attenuation factor
"DP3_SAT diffdot, normalmap, lightvec;\n"
"MUL_SAT selfshadow.r, lightvec.z, scaler.g;\n"
"DP3_SAT specdot.a, normalmap, halfvec;\n"
@ -1123,6 +1123,8 @@ void ARB_drawTriangleListBase (vertexdef_t *verts, int *indecies,
glDisable(GL_CULL_FACE);
}
glColor3ub(255,255,255);
for ( i = 0; i < shader->numstages; i++)
{
ARB_SetupSimpleStage(&shader->stages[i]);
@ -1356,6 +1358,14 @@ void ARB_drawTriangleListBase (vertexdef_t *verts, int *indecies,
{
if (shader->flags & SURF_PPLIGHT)
{
if (shader->colorstages[0].src_blend >= 0) {
glBlendFunc(shader->colorstages[0].src_blend, shader->colorstages[0].dst_blend);
glEnable(GL_BLEND);
} else {
glDisable(GL_BLEND);
}
glColor3f(0,0,0);
glDisable(GL_TEXTURE_2D);
glDrawElements(GL_TRIANGLES,numIndecies,GL_UNSIGNED_INT,indecies);

View file

@ -1270,6 +1270,8 @@ void Parhelia_drawTriangleListBase (vertexdef_t *verts, int *indecies,
glDisable(GL_CULL_FACE);
}
glColor3ub(255,255,255);
for ( i = 0; i < shader->numstages; i++)
{
Parhelia_SetupSimpleStage(&shader->stages[i]);
@ -1324,6 +1326,14 @@ void Parhelia_drawTriangleListBase (vertexdef_t *verts, int *indecies,
else if (shader->flags & SURF_PPLIGHT)
{
glColor3f(0,0,0);
if (shader->colorstages[0].src_blend >= 0) {
glBlendFunc(shader->colorstages[0].src_blend, shader->colorstages[0].dst_blend);
glEnable(GL_BLEND);
} else {
glDisable(GL_BLEND);
}
glDisable(GL_TEXTURE_2D);
glDrawElements(GL_TRIANGLES,numIndecies,GL_UNSIGNED_INT,indecies);
glEnable(GL_TEXTURE_2D);

View file

@ -1118,7 +1118,8 @@ void Radeon_drawTriangleListBump (const vertexdef_t *verts, int *indecies,
}
void Radeon_drawTriangleListBase (vertexdef_t *verts, int *indecies,
int numIndecies, shader_t *shader,
int numIndecies, shader_t *shader,
int lightMapIndex)
{
int i;
@ -1135,6 +1136,10 @@ void Radeon_drawTriangleListBase (vertexdef_t *verts, int *indecies,
glDisable(GL_CULL_FACE);
}
//PENTA: Added fix
glColor3ub(255,255,255);
for ( i = 0; i < shader->numstages; i++)
{
Radeon_SetupSimpleStage(&shader->stages[i]);
@ -1188,6 +1193,15 @@ void Radeon_drawTriangleListBase (vertexdef_t *verts, int *indecies,
}
else if (shader->flags & SURF_PPLIGHT)
{
//PENTA: added fix
if (shader->colorstages[0].src_blend >= 0) {
glBlendFunc(shader->colorstages[0].src_blend, shader->colorstages[0].dst_blend);
glEnable(GL_BLEND);
} else {
glDisable(GL_BLEND);
}
glColor3f(0,0,0);
glDisable(GL_TEXTURE_2D);
glDrawElements(GL_TRIANGLES,numIndecies,GL_UNSIGNED_INT,indecies);