Some GLSL imagery

Hello. It’s been a long time. Let’s ignore that.

In a recent urge to put more FOSS apps on my Android phone, I installed a marvelous application called Shader Editor.  The app is basically just a GLSL editor that compiles the code live. You can use then use these shader files to make them animated wallpapers for your phone.

There exists a web-app for this too, for those who don’t like writing code on a phone (it’s a nightmare, really!). It’s called GLSLSandbox. You can hence write the code online and send it to your phone for Shader Editor to make a wallpaper out of it.

So for example writing the following code in the app:

#extension GL_OES_standard_derivatives : enable
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif


#define PI 3.14159268
uniform vec2 resolution;
uniform float time;

vec2 invert(vec2 x)
{
float d=x.x*x.x +x.y*x.y;
return vec2( x.x/d,-x.y/d);
}

vec2 cube(vec2 x)
{ return vec2(x.x*x.x*x.x- 3.0*x.x*x.y*x.y,
-x.y*x.y*x.y +3.0*x.x*x.x*x.y) ;
}


vec3 design(float scal)
{
if(abs(scal) <0.54)
return vec3(0.350+0.1*sin(scal),0.230,0.25);
else
return vec3(0.3,0.1+0.05*sin(2.0*scal) ,0.2*scal);
}
void main(void) {
float mx = max(resolution.x, resolution.y);
vec2 uv = gl_FragCoord.xy / mx;
vec2 center = resolution / mx * 0.5;
float t = time * 0.40;

float scalar=sin(40.0*uv.x) *
sin(t+20.0*uv.x-1.732*20.0*uv.y) *
sin(t+20.0*uv.x+1.732*20.0*uv.y);

scalar=sin(8.0*scalar) ;
gl_FragColor = vec4(design(scalar), 1.0);
}

Gives the following result (recorded from GLSLSandbox):

hexer.gif

Soon I found myself doodling with this app, through which I created some trippy visuals that I would like to share. I’ll add them soon in a different blogpost.

Advertisements