I have made a multipass engine that works nicely. You can have a number of passes blended togeter to create nice metal effects etc (using an alphablended rusty texture on top of an an envmapped chrome texture). Unfortunately I have run into problems when I now want to move my engine into using multitexturing…
As I have understood it blending does not work “inside” a multitexturing pass. So you can not do it like this:
What you need are texture environments. These are additional blending stages inside the texture pipe, one for each texturing unit. Core GL 1.3 already allows a host of functions to be applied there, just look at table 3.24 in the spec and pick what you like.
Originally posted by tobiaso: SetUpStuffForPassOne
To translate this example to texture environments, you can leave the first one as is and select the ‘add’ function in the second one.
//don't forget that texture units must be enabled individually!
//you can select different function for rgb and alpha
//plain addition obviously needs two sources
//operand allows you to invert components or to expand alpha components to rgb
//now you can render
Zeckensack, if you want to simply add the textures, why not use ARB_texture_env_add rather than the GL_ADD combiner, that would require much less code for this example.
On the otherhand, tobiaso, if what you are asking is if it is possible to replicate all possible two pass algorithms as one pass with multitexture, then the answer is no. All opaque algorithms are available, but not all transparent algorithms.
Originally posted by DFrey: Zeckensack, if you want to simply add the textures, why not use ARB_texture_env_add rather than the GL_ADD combiner, that would require much less code for this example.
Partly because I haven’t used the plain environment modes for a looong time and wasn’t entirely sure what’s available.
OTOH, it’s nice to get a start on texture_env_combie, it offers lots of flexibility and a little bit of experience with it just might come in handy when the requirements increase.
But I agree, it’s a bit overkill for this particular case