How Can I Turn Off Texture Combinations?

Started by
2 comments, last by ajm113 14 years, 5 months ago
Hello I have a texture combiner system that works like this for a light map texture on my model for the level:


glEnable(GL_TEXTURE_2D);
				glActiveTexture(GL_TEXTURE0);
					glBindTexture(GL_TEXTURE_2D, texture[0].texID);

				glActiveTexture(GL_TEXTURE1);
				glBindTexture(GL_TEXTURE_2D, texture[1].texID);

//Render model
glMultiTexCoord2f(GL_TEXTURE0, u, v);
glMultiTexCoord2f(GL_TEXTURE1, u, v);

//Vertexes, etc...
glDisable(GL_TEXTURE_2D);


It seems after that any texture that has a alpha or if it does show it's really dark.. I'm guesting its the combiner I have going there that works on the model, but it also replaces all the textures with the texture[0].texID instead of the texture id they where assigned using glBindTexuture. Any suggestions? Thanks, Andrew. [Edited by - ajm113 on October 24, 2009 4:41:37 PM]
Check out my open source code projects/libraries! My Homepage You may learn something.
Advertisement
glDisable(GL_TEXTURE_2D) only disables the currently active texture unit. So in your example texture unit 0 is still set and active after your code there. And texture unit 1 is still the active one. So anytime you use glBindTexture afterwards it binds it to unit 1.
Is there anyway to go around that and stop doing that? Nothing I tried seems to work.
Check out my open source code projects/libraries! My Homepage You may learn something.
Woops, never mind, I got it too work!

Encase anyone else is interested..
			glEnable(GL_BLEND);				glPushMatrix();				glEnable(GL_TEXTURE_2D);				glActiveTexture(GL_TEXTURE0);				glEnable(GL_TEXTURE_2D);					glBindTexture(GL_TEXTURE_2D, texture[0].texID);     glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);     glTexGeni(GL_T,GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);				glActiveTexture(GL_TEXTURE1);				glEnable(GL_TEXTURE_2D);				glBindTexture(GL_TEXTURE_2D, texture[1].texID);     glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);     glTexGeni(GL_T,GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);				//Render model!                                RenderModel();				glPopMatrix();				// Turn the second multitexture pass offglActiveTextureARB(GL_TEXTURE1);glDisable(GL_TEXTURE_2D);glClientActiveTextureARB(GL_TEXTURE1);// Turn the first multitexture pass offglActiveTextureARB(GL_TEXTURE0);glDisable(GL_TEXTURE_2D);glClientActiveTextureARB(GL_TEXTURE0);				glDisable(GL_TEXTURE_2D);					glDisable(GL_BLEND);								glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
Check out my open source code projects/libraries! My Homepage You may learn something.

This topic is closed to new replies.

Advertisement