Render to texture
Check your repo for the RenderTexture program. Modify the texture.frag
shader to apply a post-process effect.
Rubric | | | | |----------------------|------------------|---------------| |Post process effect | 0 : Incomplete | 10 : Complete |
Here are some simple examples. You should do something more complex.
Translate:
//translate the image over by res*0.2 amount
void main()
{
fragColor = texture(texId, texCoord+0.2);
}
Threshold:
//change very blue areas to red
vec4 threshold()
{
vec4 c = texture(texId, texCoord);
if(c.b > 0.8) c = c.bgra; //swizzle blue and red
return c;
}
void main()
{
fragColor = threshold();
}
Here are some more complex effect you could try.
Swirl near mouse cursor:
Pinch near mouse cursor:
Blur:
Edge detect: