Sign in to follow this  

texture bind problem

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

I load up my building textures and *afterwards* the explosion textures like this:
buffer = LoadTexture("building.bmp", m_buildingtexture);
glBindTexture(GL_TEXTURE_2D, m_buildingtexture); //oops
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); 



buffer = LoadTexture("explosion.bmp", m_explosiontexture);
glBindTexture(GL_TEXTURE_2D, m_explosiontexture);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); //HERE**GL_MODULATE


Then when I come to render the building I:

glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, m_buildingtexture);
...render building



The problem is that when i change the GL_TEXTURE_ENV_MODE of teh explosion text at 'HERE**GL_MODULATE! - it also changes the building render as the building tex is rendered as GL_MODULATE. Why does this happen - I mean the GL_MODULATE clearly isn't set for the building texture but the explosion text ? How do I 'unset' it so that it won't effect the already set up building text ? Why does it alter the GL_REPLACE of the buildign tex ? cheers [Edited by - ade-the-heat on May 14, 2005 9:33:18 AM]

Share this post


Link to post
Share on other sites
sorry about that - it was a bad cut n paste error,
The original mail have been corrected now..
So back to the original question -
How do I 'unset' it so that it won't effect the already set up building text ?

Share this post


Link to post
Share on other sites
TexEnv parameters are a single set per texture unit. They don't get "saved" for every texture object, like TexParameters do. So, set GL_REPLACE before you render the explosion, and GL_MODULATE before you render the buildings.

Share this post


Link to post
Share on other sites

This topic is 4600 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this