Sign in to follow this  

Let me ask about Textures

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

when I do this first glTexEnvi(GL_TEXTUE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); then later on I use texture Objects with glBindTexture so I wanna ask does those texture environment Setting Above affact to each Texttures object unill we change it or every call glBindTexture we must set the Environment Again?? I wanna know this and I will be Happy if every call glBindTexture I dont need to Set Environtment Again ,coz I want every Texture Objects have the same Env Textures like that' Tell me plzz thank u

Share this post


Link to post
Share on other sites
You only need to set the texture parameters once when you setup the texture, later on if you decide you need to change them call the texture object and then glTexEnv() or glTexParamter() and set the new parameters up for that object... HTH

Share this post


Link to post
Share on other sites
TexEnv settings are maintained per texture unit while TexParameter settings are maintained per texture object. Sorry for the very short post (in a hurry) but I think you'll find this mentioned in the spec.

Share this post


Link to post
Share on other sites
I'll expound a bit on deavik's post...

Texture parameters are per-texture-object state. When you call glTexParameter you are acting on the currently bound texture object, which is the last texture you bound with glBindTexture (on the current texture unit) or, if you haven't bound any texture, the default texture (with texture name 0).

Texture environment is per-texture-unit state. When you call glTexEnv you are acting on the current texture unit, which is set by calling glActiveTexture.

So as an example, suppose you do this...
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 24);
//All glTexEnv calls will affect texture unit 0's environment state and
//all glTexParameter calls will affect texture object 24's parameter state.

glBindTexture(GL_TEXTURE_2D, 58);
//All glTexEnv calls still affect texture unit 0's environment state, but
//now all glTexParameter calls affect texture object 58's parameter state.

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, 42);
//Now all glTexEnv calls affect texture unit 1's environment state and all
//glTexParameter calls affect texture object 42's parameter state.

glActiveTexture(GL_TEXTURE0);
//Now all glTexEnv calls affect texture unit 0 again and all glTexParameter
//calls affect texture object 58 again because that was the last texture
//bound to unit 0



I hope that cleared things up instead of confusing.

Share this post


Link to post
Share on other sites

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