An array component Array1 filled with some dummy data(eventually this will be filled with either AudioArray or SpecBandArray data).
A shader component Shader1 with a uniform variable sba: VariableName = sba, ValueArrayRef = Array1,ArrayKind = Texture2D.
VertextShaderSource
Code: Select all
void main(){
vec4 vertex = gl_Vertex;
vertex.xy *= 2.0;
gl_Position = vertex;
}
Code: Select all
uniform float resX;
uniform float resY;
uniform float itime;
uniform float viewportX;
uniform float viewportY;
uniform sampler2D sba;
vec2 iResolution = vec2(resX,resY);
void main()
{
float val;
vec2 uv = (gl_FragCoord.xy-vec2(viewportX,viewportY)) / iResolution.xy;
if(uv.x > 0.2 && uv.x < 0.4)
{
val = texelFetch(sba, ivec2(0,0), 0).r;
//val = clamp(textureLod(sba, vec2(0,0.0), 0.0).r, 0.0, 1.0);
// val = texture2D(sba,vec2(0, 0.0)).x;
//val = clamp(textureLod(sba, vec2(int(0),0.0), 0.0).r , 0.0, 1.0);
//val = 0.5 ;
gl_FragColor = vec4(val,val,val,1.0);
//gl_FragColor = texelFetch(sba, ivec2(0,0), 0).;
}
else
{
gl_FragColor = vec4(uv,0.5+0.5*sin(itime),1.0);
}
}
Thanks,
Brandon