PDA

View Full Version : help me with GL_EXT_texture_env_combine?!



crashed_dog
02-24-2004, 10:24 AM
i'm trying to use texture_env_combine to combine an alpha map texture with an RGB texture. I'm using it for a landscape, to smoothly blend multiple layers together. I can't figure out how to set up each stage to blend. I'm using a TNT card, so I have to draw in multiple passes. Can anyone help me? I can't get on the internet much, so if someone could maybe write up some pseudo-code and email it to me or email me with your reply, that'd be great. thanks for any help.

-bryan
crashed_dog@juno.com

Ob1
02-25-2004, 01:10 PM
You should check out opengl 1.5 specs, there's some hint on how to use the combine environeament.
There's a couple of things you have to do. First you set the COMBINE method for current texture with :
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );

then you'll have to choose a texture blending equation for current texture with :
glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE );

This sets an equation for blending. You can find details for equation on openglspecs.
In this case, GL_INTERPOLATE is something like :
Arg0*Arg2 + Arg1*(1-Arg2)
Where you set your desired Argn with
strings like :
glTexEnvf( GL_TEXTURE_ENV, GL_SOURCEn_RGB, GL_PREVIOUS );
glTexEnvf( GL_TEXTURE_ENV, GL_OPERANDn_RGB, GL_SRC_COLOR );

Again, for more details check the specs.

Hope it was helpful somehow!
Byez =8)!
Ob1

crashed_dog
02-26-2004, 02:56 PM
thanks for replying

i finally figured it out. i didn't even need the combine extension! the interpolate wouldn't work when using alpha maps since a TNT can only sample 2 texels per pass. i tried just about every combo with the combine_ext. but turns out that i didn't even need that... silly me...