PDA

View Full Version : Multi-texturing



dmacnevin
11-08-2004, 11:12 AM
Hey everyone,

I'm having some problems regarding mult-texturing. I have a simple object that I want to be able to apply 2 textures to. I have managed to get one texture applied to this object, and I have the code set up so that it will mult-texture.

The problem is that once I apply two textures to the object, I loose all lighting in the scene (I think this is what is happening.) Once I remove multi-texturing, the object is then black and I can't seem to figure out what is happening. I have tried to re-enable the lighting and also disable both textures but this does not seem to be working.

This is the code that I used to set up my textures

glActiveTextureARB(GL_TEXTURE0_ARB);
glBindTexture (GL_TEXTURE_2D, m_worldTextures[0]);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

glActiveTextureARB(GL_TEXTURE1_ARB);
glBindTexture (GL_TEXTURE_2D, m_worldTextures[1]);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_LIGHTING);I tried using this code to turn off both textures:

glActiveTexture(GL_TEXTURE2);
glDisable( GL_TEXTURE_2D );
glActiveTexture(GL_TEXTURE1);
glDisable( GL_TEXTURE_2D );Does anyone have any ideas as to what could be causing the problem, or any links to information that might be helpful?

Thanks
Danielle

Aeluned
11-08-2004, 11:29 AM
you're not selecting the correct texture units in your disabling code block (just a head's up).

do you have other objects in the scene?
render a lit cube or something after the multi textured object...if the cube isn't lit, then you haven't re-enabled lighting.

dmacnevin
11-09-2004, 07:10 AM
thanks,

it was that I wasn't selecting the correct texture units for disabling! It was causing such a headache and it was so simple...lol

again, thank-you!
Danielle