Original Post
Hi., What i'm tryng to do, is a simple post-processing effect, only on some surfaces of the game (glass,etc). So, what i do is i capture the framebuffer to a rectangle texture, and then i want to distort it using a normal map (2d regular texture). This is the CG shader:
void main(
float4 TexCoord0 : TEXCOORD0,
float4 TexCoord1 : TEXCOORD1,
out half4 oColor : COLOR,
uniform float timer,
uniform samplerRECT Texture0,
uniform sampler2D Texture1
)
{
float3 noiseVec;
float2 displacement;
displacement = TexCoord0.xy;
displacement.x += timer;
displacement.y += timer;
noiseVec = normalize(tex2D(Texture1, displacement.xy));
noiseVec = (noiseVec.xyz * 2.0 - 1.0) * 0.035;
oColor = texRECT(Texture0, TexCoord0.xy + noiseVec.xy);
}
The result that i have, is a simple offset of the texture, and nothing else. I tried replacing the rectangle texture with a 2d texture, and it seems to be working, but i really need to use a rectangle texture, so, it seems this is not the correct way to use rectangle textures ? Anyone sees a problem in the shader ? And just for clarity, i'm enabling GL_TEXTURE_RECTANGLE_NV, and GL_TEXTURE1_ARB.