GLSL Shader compiles but doesn't work

Daniel Tompkins's icon

Hello!
I'm rather new to shader programming, and was trying my hand at messing with an example from the Book of Shaders. My code works well in the BoS GLSL host, as well as other web based hosts, and the code even compiles in Max, but for some reason it doesn't show anything in pwindows or world. I'm at a loss for what's going wrong.

<jittershader name="color generation shader">
    <description>
    creates gradients using RGB parameter input
 and generates a texture of that single color
    </description>
    <param name="u_time" type="float" default="0." />
    <param name="amp" type="float" default="0." />
    <param name="rgb" type="vec3" default="0. 0. 0."/>
    <param name="u_mouse" type="vec2" default="0. 0." />
    <param name="tex0" type="int" default="0" />
    <param name="tex1" type="int" default="1" />
    <language name="glsl" version="1.0">
        <bind param="u_time" program="fp" />
        <bind param="amp" program="fp" />
        <bind param="rgb" program="fp" />
        <bind param="u_mouse" program="fp" />
        <bind param="tex0" program="fp" />
        <bind param="tex1" program="fp" />
        <program name="vp" type="vertex" source="sh.passthrudim.vp.glsl" />
        <program name="fp" type="fragment">
<![CDATA[


// variables and parameters

varying vec2 texcoord0;
varying vec2 texdim0;
uniform sampler2DRect tex0;

varying vec2 texcoord1;
varying vec2 texdim1;
uniform sampler2DRect tex1;

uniform float u_time;
uniform float amp;
uniform vec2 u_mouse;
uniform vec3 rgb;

float PI = 3.141592654;
float TwoPI = PI*2.;
float fourth = (PI*4.)/3.;
float third = TwoPI/3.;

void main(){
    vec2 st = gl_FragCoord.xy/texdim0.xy;
    float red = 0.0;
    float blue = 0.0;
    float green = 0.0;
    float val = 25.0;
    float x = 0.5;
    float y = 0.5;
    float r = (-1. * rgb.r)+1.;
    float g = (-1. * rgb.g)+1.;
    float b = (-1. * rgb.b)+1.;

    red = pow(distance(st,vec2((sin(u_time)/(r*val))+x,(cos(u_time)/(r*val))+y)),distance(st,vec2((sin(u_time)/(b+g))+x,cos(u_time)/(b+g))+y));
    
    
    blue = pow(distance(st,vec2((sin(u_time-third)/(b*val))+x,(cos(u_time-third)/(b*val))+y)), distance(st,vec2((sin(u_time-third)/(r+g))+x,(cos(u_time-third)/(r+g))+y)));
    
    
    green = pow(distance(st,vec2((sin(u_time-fourth)/(g*val))+x,(cos(u_time-fourth)/(g*val))+y)), distance(st,vec2((sin(u_time-fourth)/(r+b))+x, (cos(u_time-fourth)/(r+b))+y)));
    

    vec3 color = vec3(red,green,blue);

    gl_FragColor = vec4(color, 1.0 );
    }

]]>
        </program>
    </language>
</jittershader>
Rob Ramirez's icon

please paste in the patch you are using to test this with. better yet attach a zip file containing the patch and the JXS file.