https://glslfan.com/?channel=-L_NAXqFFl9RAZ2eBIaH
This is a web GLSL shader effect.
Maybe can't be loaded on some browser or old ones.
Anyway if your browser support compiled, it will show.
Full code here
#version 300 es
// - glslfan.com --------------------------------------------------------------
// Ctrl + s or Command + s: compile shader
// Ctrl + m or Command + m: toggle visibility for codepane
// ----------------------------------------------------------------------------
precision mediump float;
uniform vec2 resolution; // resolution (width, height)
uniform vec2 mouse; // mouse (0.0 ~ 1.0)
uniform float time; // time (1second == 1.0)
uniform sampler2D backbuffer; // previous scene
out vec4 fragColor;
void main()
{
int t = int(time*12.0);
vec2 uv = (gl_FragCoord.xy*2.0-resolution.xy)/resolution.y;
ivec2 p = ivec2(pow(abs(uv*32.0),vec2(0.4))*16.0);
int ptn = int(time*0.1)%3;
int q = int[](p.x|p.y, p.x&p.y, p.x^p.y)[ptn];
t = (t&63^t<<q*(t%9)) |(t&63|t<<q*(t&7)) ^ (t*2*(t&63|t<<q*(t&15)));
float x = float((t>>0&15)+(t>>4&15)+(t>>8&15))*0.1;
vec3 col = vec3(0.7,0.2,0.1)*fwidth(x);
fragColor = vec4(col,1);
}
My question is there is a line.
int q = int[](p.x|p.y, p.x&p.y, p.x^p.y)[ptn];
Looks like dynamic array,but what does the content inside () mean?
Is it init list or something else?
And this code compile successfuly.
So I think the grammar is correct,but I never seen or learn anything about something like this.
Could someone explain why this is correct and what does it mean?
And is there some document or example teach or show you that you can use it like this?
Need more example