0

I have question How can i run ShaderToy code Standalone in windows web browser like firefox or chrome

for example like this code:

#define PI 3.141592653589793

void mainImage(out vec4 fragColor, in vec2 fragCoord)
{
    vec2 pixel_count = max(floor(iResolution.xy * vec2((cos(iTime) + 1.0) / 2.0)), 1.0);
    vec2 pixel_size = iResolution.xy / pixel_count;
    vec2 pixel = (pixel_size * floor(fragCoord / pixel_size)) + (pixel_size / 2.0);
    vec2 uv = pixel.xy / iResolution.xy;

switch (int((iTime + PI) / (2.0 * PI)) % 4)
{
    case 0:
        fragColor = vec4(texture(iChannel0, uv).xyz, 1.0);
        break;
    
    case 1:
        fragColor = vec4(texture(iChannel1, uv).xyz, 1.0);
        break;
    
    case 2:
        fragColor = vec4(texture(iChannel2, uv).xyz, 1.0);
        break;
    
    case 3:
        fragColor = vec4(texture(iChannel3, uv).xyz, 1.0);
        break;
}
}

https://www.shadertoy.com/view/4l2fDz

I know fragColor becomes gl_FragColor and gl_FragCoord, void mainImage becomes voice main() , iTime becomes time iResolution becomes resoluton and iChannel becomes media But how i can add multiple images or videos to media , as you see mutiple ichannels in above shadertoy code.

Can anyone give a example of above code to run standalone in web browser.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
smallbee
  • 233
  • 1
  • 4
  • 16

0 Answers0