PDA

View Full Version : How do I undo these tex env values?



halo
11-14-2005, 08:16 PM
I use these values when doing texture splatting, but I don't know how to switch them back to their default setting when I am done:

glTexEnvf GL_TEXTURE_ENV,GL_SOURCE0_RGB,GL_PRIMARY_COLOR
glTexEnvf GL_TEXTURE_ENV,GL_OPERAND0_RGB,GL_SRC_COLOR
glTexEnvf GL_TEXTURE_ENV,GL_SOURCE1_RGB,GL_TEXTURE1
glTexEnvf GL_TEXTURE_ENV,GL_OPERAND1_RGB,GL_SRC_COLOR
glTexEnvi GL_TEXTURE_ENV,GL_SOURCE0_ALPHA,GL_TEXTURE0
glTexEnvi GL_TEXTURE_ENV,GL_OPERAND0_ALPHA,GL_SRC_ALPHA
glTexEnvi GL_TEXTURE_ENV,GL_SOURCE1_ALPHA,GL_TEXTURE0
glTexEnvi GL_TEXTURE_ENV,GL_OPERAND1_ALPHA,GL_SRC_ALPHA

dorbie
11-14-2005, 11:40 PM
Just turn off texture combiner mode switching to GL_MODULATE for that unit when you're done and you'll probably be good to go.

Code using combiners after you shouldn't be making assumptions about the state of the inputs and operators unless you have to cooperate with some other software that tracts state in app code in which case defaults won't cut it.

I sure wouldn't set combiner state relative to the default setting, that's just asking for trouble.

halo
11-15-2005, 09:34 AM
That won't work. I still use combiner for other (simpler) things. I need to undo these changes, beck to their default settings.

11-15-2005, 04:02 PM
The default environment combine mode is modulate, as is stipulated in the spec.

If the particular bit of information you seek is not detailed explicitly in the spec, then it is likely an implementation detail; and in such a case, there is no specified default behavior to rely upon.

halo
11-15-2005, 07:07 PM
I am setting the combine mode back to modulate, but something else in those settings is making the texture full-bright.

Overmind
11-16-2005, 12:56 AM
You could use glPush/PopAttrib(GL_TEXTURE_BIT) to save and later restore the texture environment.

The other possibility is to look in the GL spec in the state tables what the default state for each variable is and set them to exactly that.