PDA

View Full Version : Adding two GL_DSDT_NV textures



k_szczech
06-29-2006, 01:15 PM
To explain what I'm trying to do I'll put a GLSL shader here:

void main(void)
{
vec2 offset;
offset = texture2D( unit0, texcoord[0].xy ).rg;
offset += texture2D( unit1, texcoord[1].xy ).rg;
gl_FragColor.a = texture2D( unit2, texcoord[2].xy).a;
gl_FragColor.rgb = texture2D( unit3, texcoord[3].xy + offset).rgb;
}I'm trying to implement above shader using NV_texture_shader.
I put DSDT_NV textures into unit #0 and #1, and the RGBA texture into units #2 and #3 (the same texture - I'm reading it twice).

Here is my configuration:
unit / format / shader / env
#0 / DSDT_NV / TEXTURE_2D / GL_REPLACE
#1 / DSDT_NV / TEXTURE_2D / GL_ADD
#2 / RGBA / TEXTURE_2D / GL_REPLACE
#3 / RGBA / OFFSET_TEXTURE_2D_NV / GL_COMBINE_ARB

Combine at unit #3:
RGB = REAPLACE / TEXTURE / SRC_COLOR
ALPHA = REPLACE / PREVIOUS / SRC_ALPHA

The problem is that if I use unit #0 as input for OFFSET_TEXTURE_2D_NV then I get what I expect - final image distorted by texture #0, but when I use unit #1 as input then I get my image distorted by unit #1 only. I want it to be distorted by sum of units #0 and #1.

k_szczech
06-30-2006, 06:20 AM
Anyone?
I've just finished implementing the above using ATI_fragment_shader. It would be great if I could finish the NV_texture_shader version now.

k_szczech
07-01-2006, 04:49 AM
I've changed my code to use dependent-gb reads, but the problem remains. I'll leave it at that. :p