shader not working

Feb 8, 2010 at 7:41pm

shader not working

Can anyone figure out why this shader isn’t working?

simulates the flickering of a television screen

< ![CDATA[

uniform float amount;
uniform sampler2DRect tex0;
uniform sampler2DRect tex1;
varying vec2 texcoord0;
varying vec2 texcoord1;

void main()
vec4 a = texture2DRect(tex0, texcoord0);
vec4 b = texture2DRect(tex1, texcoord1);

gl_FragColor = mix(a,b, amount);


Feb 8, 2010 at 10:04pm

can you provide a test patch? nothing looks amiss here to me.

Feb 8, 2010 at 10:31pm

Error messages?
When you say “isn’t working”, what isn’t working about it? I imagine it probably doesn’t live up to “simulates the flickering of a television screen”, but beyond that it looks fine.


Feb 9, 2010 at 12:23am

No error messages; it just doesn’t appear to be doing anything- I just see the video passed through’s right inlet with no apparent alterations.

Andrew, I’m testing this with the patch from your “Your First Shader” article with another hooked up to the right inlet of

I’m not sure I have the math correct for my desired effect, which is roughly the below patch, but figured *somthing* would happen.

– Pasted Max Patch, click to expand. –
Feb 9, 2010 at 2:12am

change the line


this tells the shader to bind tex1 to the second slab input.

Feb 9, 2010 at 11:42pm

Thanks, Rob. That solves it. Now I can play with the math a little.


You must be logged in to reply to this topic.