PDA

View Full Version : GL_COMBINE_EXT problems



MButchers
01-07-2002, 02:35 AM
hello there,

im currently trying to get rivers and paths etc
textured over my terrain using multitexturing with
combiners, the paths,rivers etc are alpha blended over
the non alpha channel terrain texture.

Im using the following code (copied from Tom Nuydens example at delphi3d.net)
however my primitives are always alpha blended according to tex2,
Toms example works great http://www.opengl.org/discussion_boards/ubb/smile.gif ( so its not a driver issue ).

{ Setup the combiner to output (C1*A2) + (C2*(1-A2)), where C1 and C2 are
the colors of Tex1 and Tex2, and A2 is the alpha of Tex2. }
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_INTERPOLATE_EXT);
// Operand0 is the color of the previous stage (Tex1).
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_PREVIOUS_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
// Operand1 is the color of the current stage (Tex2).
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
// Operand2 is the alpha of the current stage (Tex2).
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_ALPHA);

does anyone have any ideas as to why this is.


Many thanks.

Mark.

MButchers
01-07-2002, 03:01 AM
Think ive found my problem

use
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE, GL_REPLACE);

after binding texture unit 1

http://www.opengl.org/discussion_boards/ubb/smile.gif