fragment * tex0 * constant * tex1

im trying to do either of these in a single pass
fragment * tex0 * constant * tex1
fragment * tex0 - constant * tex1

ie AB * CD or AB - CD

with either combine/nv_combine4 but have got the feeling its impossible, am i right?

cheers zed

Yes, both of those are impossible with just either of those extensions.

cheers DFrey i had a feeling you were gonna answer.
i sort of similated what i was wanting to do with the nvcombine4 + using AB + CD - 0.5 ( and careful chossing of textures ) but still it wasn’t 100%. looks like im gonna be forced to do multiple passes. bummer

If you’re using NV_texture_env_combine4 => you must have nVidia hardware => you could use register combiners. What about something like this:

// This one for fragmenttex0-consttex1.
"!!RC1.0
"
"const0 = (x, y, z, w);
"
"final_product = -const0 * tex1;
"
"out.rgb = col0 * tex0 + final_product;
"
"out.a = …;
"

// Or this for the fragmenttex0consttex1.
"!!RC1.0
"
"const0 = (x, y, z, w);
"
"{
"
" rgb {
"
" spare0 = col0 * tex0;
"
" }
"
"final_product = const0
tex1;
"
"out.rgb = spare0 * final_product;
"
"out.a = …;
"

That’s pretty quick, isn’t it? One final combiner for the top one and a general and final for the second. Hopefully davepermen won’t read this and rip my string to bits It should work, though, and should be done in one pass with no performance hit as well. Although, I have a funny idea you have a TNT in which case this is pretty useless so sorry it that’s the case.

true i have a nvidia card (vanta) but unfortunately register combiners are only avialable with geforce1+

cheers guys ive come up with a better solution that maybe of interest to yous.

let GL_TEXTURE_ENV_COLOR alpha be how much of tex0 u want to see.
this is ideal for fading in textures eg detailtextures without resorting to blending or fog

// tex0 * constant + tex1 * (1-constant) - 0.5

glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, gradient_texture1); // detail
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT, GL_ADD_SIGNED_EXT );
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT, GL_TEXTURE );
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_CONSTANT_EXT );
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT, GL_TEXTURE1_ARB );
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE3_RGB_EXT, GL_CONSTANT_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_ALPHA);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT, GL_SRC_COLOR);
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND3_RGB_EXT, GL_ONE_MINUS_SRC_ALPHA);

	glActiveTextureARB(GL_TEXTURE1_ARB);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, colour);		

	// prev * frag + tex1 * frag

	glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,  GL_COMBINE4_NV); 
	glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB_EXT,	GL_MODULATE );
	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE0_RGB_EXT,	GL_PREVIOUS_EXT);
	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT,	GL_PRIMARY_COLOR_EXT);
	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE2_RGB_EXT,	GL_TEXTURE);
	glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE3_RGB_EXT,	GL_PRIMARY_COLOR_EXT);
	glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB_EXT,	GL_SRC_COLOR);
	glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT,	GL_SRC_COLOR);
	glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND2_RGB_EXT,	GL_SRC_COLOR);
	glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND3_RGB_EXT,	GL_SRC_COLOR);

ignore the above post hehe i had only tested it on a half yellow/red texture, thus it does appear to work but failed on ‘normal textures’.
the above though is possible if u can do a subtract on the 2nd unit. which is part of the tex_env_combine (in opengl1.3) just need to wait for the drivers.