Texture blending help!

Hi all,
How do you do texture blending? I tried setting GL_BLEND, but than everything turns blue.

Let me explain what I am trying to do so it can shed some light on the problem. I got some terrain. I render it first pass with 4 texture units using multitexture. All is cool. For my details I had to use GL_LUMINANCE, and GL_COMBINE_ARB to make it come out right, otherwise it turns blue if I try to blend things.

Now I want to do a second pass on top of the first one, with 4 more textures and blend them into the final result. If i use GL_BLEND, I get blue result. If I enable GL_BLEND and glBlendFunc(GL_ONE, GL_ONE) my fog turns everythign bright white.

Help please I know I’m not an OpenGL genius here but I’m getting better at it and with your help I’ll tame the beast.

Appreciate it.

Have you tried other combinations?

glBlendFunc (GL_ONE, GL_ZERO);
or
glBlendFunc (GL_ZERO, GL_ONE);
or maybe this would work
glBlendFunc (GL_ZERO, GL_ZERO);

cant try this myself at the moment,
so this combinations might be stupid.

EDIT: or maybe you hadnt disabled fogging for first pass?

[This message has been edited by MichaelK (edited 11-07-2002).]

Oh I tried everything, finally got something what I wanted except no matter what I do with fog (turning it on off) it still looks weird.

I found out that using GL_BLEND in glTexEnv is undefined on 3 or 4 component textures, so that is why I get all blue. It seems it only works with LUMINANCE or INTENSITY textures.

Thanks

Hi, GL_BLEND works for every component texture, 1, 2, 3, or 4. All are calcuated differently. If I were to do what your trying to do, I would use ARB_texture_env_combine to combine the first 4 textures, and the second 4 textures, then blend the 2 together with glBlendFunc. If you dont want to use ARB_texture_env_combine and just use regular texture blending, remember that each successive texture uses the previously applied textures resulting fragment.

Also, you may not have 4 texture units. What card to you have?

Old GLman