mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 17:18:12 -05:00
21 lines
580 B
Text
21 lines
580 B
Text
uniform sampler2D mainTex;
|
|
varying vec2 uv;
|
|
|
|
void main()
|
|
{
|
|
vec4 c = vec4(0.0);
|
|
|
|
// various loop forms
|
|
for (int i = 0; i < 100; ++i)
|
|
c.x += texture2D (mainTex, uv + vec2(i,i)).r;
|
|
for (int i = 0; i <= 100; i += 3)
|
|
c.x += texture2D (mainTex, uv + vec2(i,i)).r;
|
|
for (int i = 100; i >= 0; --i)
|
|
c.x += texture2D (mainTex, uv + vec2(i,i)).r;
|
|
int n = int(c.x * 10.0);
|
|
for (int i = 3; i < n; ++i)
|
|
c.x += texture2D (mainTex, uv + vec2(i,i)).r;
|
|
for (int i = 1, j = 2; i < 100 && j < 50; i += 2, j += 3)
|
|
c.x += texture2D (mainTex, uv + vec2(i,j)).r;
|
|
gl_FragColor = c;
|
|
}
|