Original Post
im trying to build my own q3map renderer and im stuck at the moment with the multiple passes of the q3 shaders.
actually everything works fine if i just draw one texture a time but once i use more than one unit the whole level looks dark and also everything is transparent...
i assume there could be a problem with the blending mode (not sure if it affects only one texture (2 seperate modes for 2 textures) or the whole fragment.
i have tried it with glTexEnv() but the results are not that good...
also as some of you know the seperate stages have special blending modes associated so is there even a possibility to do int with glTexEnv() because this finction doesnt seem to support many blending options...
heres the code (if i leave stage 2 out all works fine) the shader stuff sets the current texture, depth func, depth mask, alpha test and blend func.
maybe someone can help me with this...
thanks in advance
phreak
while(true)
{
// g_Shader.SetShaderStage returns:
// -1 no more left
// 1 lightmap
// 0 default
// 2 not active
// BEGIN STAGE 1
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
val=g_Shader.SetShaderStage(I);
while(val==2)
{
val=g_Shader.SetShaderStage(I);
if(val==-1)
return;
}
if(val==-1)
return;
if(val==1)
{
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(sVertex), &(Vertices[0].LMapCoord));
g_TextureManager.ActivateTexture(LightMapToTexture[current->LightMapID]);
}
else
{
glClientActiveTextureARB(GL_TEXTURE0_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(sVertex), &(Vertices[0].TexCoord));
}
glEnable(GL_TEXTURE_2D);
// END STAGE 1
// BEGIN STAGE 2
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
val=g_Shader.SetShaderStage(I);
while(val==2)
{
val=g_Shader.SetShaderStage(I);
}
if(val==-1)
glDisable(GL_TEXTURE_2D);
if(val==1)
{
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(sVertex), &(Vertices[0].LMapCoord));
g_TextureManager.ActivateTexture(LightMapToTexture[current->LightMapID]);
}
else
{
glClientActiveTextureARB(GL_TEXTURE1_ARB);
glTexCoordPointer(2, GL_FLOAT, sizeof(sVertex), &(Vertices[0].TexCoord));
}
glEnable(GL_TEXTURE_2D);
// END STAGE 2
// do drawing stuff
}