Jump to content
  • Advertisement
Sign in to follow this  
ajm113

How Can I Turn Off Texture Combinations?

This topic is 3162 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

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]

Share this post


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

Share this post


Link to post
Share on other sites
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 off
glActiveTextureARB(GL_TEXTURE1);
glDisable(GL_TEXTURE_2D);
glClientActiveTextureARB(GL_TEXTURE1);

// Turn the first multitexture pass off
glActiveTextureARB(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 );


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!