//This has been tested and works in AGK classic
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define PROCESSING_TEXTURE_SHADER
varying mediump vec2 uvVarying;
uniform sampler2D texture0;
uniform vec2 rot; //where rot is a vector passed to the shader from my AGK program
void main(void)
{
vec2 p = uvVarying;
if (rot.x ==1.0)
{p.x=rot.x-p.x;}
if (rot.y==1.0)")
{p.y=rot.y-p.y;}
vec3 col = texture2D(texture0, p).rgb;
gl_FragColor = vec4(col, 1.0);
}
without the if statements i.e and rot.x =0 then "p.x=rot.x-p.x" fails (the same for the second vector rot.y im looking for a simple math work around that removes the if statement for performance
if you want to remove if statement and your rot.x and rot.y values could be either 0.0 or 1.0, then I would suggest to try with a mix function
vec2 p = mix(uvVarying, rot - uvVarying, rot);