PDA

View Full Version : BlendFunc() vs Combine_EXT



FXO
10-02-2001, 01:36 PM
Can anybody explain the difference between blending texures using BlendFunc()-operators,
and using glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT)?

Is their only differance that you set up the blending when multitexturing when using TexEnv?

Any help would be appreciated, cuz Im totally stuck, can't figure this out...

Thanks
/Fredrik Olsson

Bob
10-03-2001, 12:05 AM
glTexEnv operates on a fragment (while creating it), and glBlendFunc mixes this fragmet (after it has been created) with the framebuffer.

When using (multi)texturing, you use glTexEnv to tell OpenGL how you want the primary color, texture colors, and all other colors building a pixel, to be mixed together for a final color. When this is done, you use glBlendFunc to blend this color with the color in the framebiffer, to create a transparency effect, or to make additive blending, for example.

They are two completely different thing, and have nothing to do with eachother.

FXO
10-03-2001, 02:51 AM
Thanks!
That cleared things up a lot!

I have one more questing:
You can blend two textures using multitexturing.
Is there a way to use the BlendFunc()-operators to set the blending-mode?
Or are you stuck with GL_MODULATE?

btw. TextureEnvMode has "GL_BLEND" as an operator, how does that work?

Bob
10-03-2001, 03:13 AM
There's no way to use glBlendFunc to blend two textures together (unless you want multiple passes, but I suppose that's not what you mean), this function only operates with a complete fragment and the framebuffer (i.e. after textures has been applied).

There are more ways than just GL_MODULATE to mix textures. ARB_texture_env_add can add the color of a texture. ARB_texture_env_combine provides a few more operators. Have a look at these extensions for more details.

FXO
10-03-2001, 06:15 AM
I have a material with 'n' layers, which should be blended according to the
layer->blend_src
&
layer->blend_dst

I wanted to make the renderer use multitexturing when present, but still work with multi-pass-rendering.
Seems as this can't be done with blend_src & blend_dst, perhaps I should limit myself to:
MODULATE, REPLACE, ADD..

Hope you understand what i mean http://www.opengl.org/discussion_boards/ubb/wink.gif

*blen_src & blend_dst used with glBlendFunc
*Used COMBINE_EXT, but couldn't make use of the same operators as with blend..

FXO
10-10-2001, 08:10 AM
It doesn't seem as if it works to use the same operators, so Im limiting myself to only using GL_MODULAT, GL_REPLACE etc..

thanks for your help!
/Fredrik Olsson

10-22-2001, 03:15 AM
Use glBlendFunc (GL_ONE, GL_ZERO);