I wrote a couple of new objects to simplify the handling of opengl textures and glsl filters in Processing.
The PTexture object is a descendant of PImage. It holds an opengl texture that can be copied from and to the pixel property. Then the PTextureFilter allows for applying glsl filters to the PTexture objects. The filter can include grid mapping and distortion of the texture through the use of vertex shaders.
I tried to implement these objects in a way that they follow the “Processing style” of defining methods, etc.:
PTexture tex0, tex1;
tex0 = new PTexture(this, “milan_rubbish.jpg”);
tex1 = new PTexture(this, tex0.width, tex0.height);
pulseEmboss = new PTextureFilter(this, “pulsatingEmboss.xml”);
A full online example is available here:
The goal is compile all this code as a new library.