Skip to main content
gamedev.net
🔒 Locked

multiple pass multitexturing problem

Started by LousyPhreak Jun 1, 2002 at 10:44 AM 1 replies 950+ views
Original Post
LousyPhreak
LousyPhreak
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

}
  
http://mitglied.lycos.de/lousyphreak/
LousyPhreak
LousyPhreak
no one??

mfg Phreak
--
"Input... need input!" - Johnny Five, Short Circuit.
http://mitglied.lycos.de/lousyphreak/
bj
bj
Hello
i''ll try to help ya, but im not sure
One of the BIG problem is all the possibilities between the number of texture units available and the number of passes. It seems that Q3 use classic glBlendFunc for most of the passes and multitexturing for lightmap. If u could be more precise about the rest of the could. I think that blendFunc do not work with multi passes and you have to use the texture_combine extension.

see ya.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.