blendfunc(dst_color, one_minus_dst_alpha) in multitexturing?

Started by
0 comments, last by WarAmp 19 years, 6 months ago
I am writing a multitexture renderer, and at the moment am trying to convert all of the more used blendfunc calls into texture_env_combine equations. The one I am stuck on is blendfunc(gl_dst_color, one_minus_dst_alpha). I am wondering if this is even possible using tex_env_combine? blendfunc(gl_dst_color, one_minus_dst_alpha) breaks down to the equation: (src_color * dst_color) + (dst_color * one_minus_dst_alpha) it could be rewritten as: dst_color * (src_color + one_minus_dst_alpha) using glTexenvi() we are restricted to the following functions: REPLACE Arg0 MODULATE Arg0 * Arg1 ADD Arg0 + Arg1 ADD_SIGNED_ARB Arg0 + Arg1 - 0.5 INTERPOLATE_ARB Arg0 * (Arg2) + Arg1 * (1-Arg2) SUBTRACT_ARB Arg0 - Arg1 No matter which way I look at it, I can't fit the above equation into terms that work with any of glTexenvi's capabilities. Going with the rewritten equation, it would require a modulation of src_color and one_minus_dst_alpha, and then an ADD of the result of that modulation and dst_color. I have just begun using the tex_env_combine extensions, so I dont' know everything about them, but is there any way to stack operations like this? to say....do a modulation and store it somehow, an then use the result as an argument to an addition?
Advertisement
You can set up a texture_env_combine equation per texture stage.

so you can do the ADD in texture unit 0 and then do the multiply with GL_PREVIOUS in texture unit 1.

You may need the env_crossbar extension, but afaik, its supported everywhere env_combine is.
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.

This topic is closed to new replies.

Advertisement