Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

LousyPhreak

multiple pass multitexturing problem

This topic is 5949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

}
  

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!