I originally asked this in the beginners group awhile back, but the responses, while helpful, didn’t solve my problem so I decided to bump it up here.
Basically I’m working with two texture units and polygon color. What I would like to do is have both texture units be modulated with the polygon color but not with each other. I have no idea if it’s possible, I hope it is.
There are two methods that come close but don’t quite do it.
The second one comes the closest but it causes the first texture to be masked out. I’ve tried hundreds of ways, changing everything from the blendmodes to rgbsources. I’ve gotten close, but can’t seem to do it.
I’m still trying to get to grips with texture combiners myself (especially since I’m not sure if all texenv calls are local to the active texture stage), but how about something like this:
Originally posted by CrazyButcher:
[b]use crossbar functionality:
ARB_texture_env_crossbar or NV_texture_env_combine4 extensions will help you.
using ARB_texture_env_combine you can do
tex0: interpolate tex0 and tex1
tex1: modulate prev with primary color[/b]
Where can I find more on crossbar functionality? Well I found the Spec on it. Example source code would probably be more helpful.
It’s a really simple extension that extends the combiners.
It just allows you to use GL_TEXTURE?_ARB (with ? being the number of a texture unit) as argument for GL_SOURCE?_RGB (or ALPHA), just like you would use GL_TEXTURE when you want the current texture unit.
I think I’m a little over my head here. I’m a little confused about how these two extensions are used. It’d be helpful to see an example. All I can find is documentation. I can’t find any example code.
Judging by the extension spec (new state: none), you don’t need to enable it.
So for a quick and dirty version, you should be able to just use it.
But if you want to be robust, you should check at runtime if the extension is supported on the card, and use a different method (3 units or multipass) if it’s not.