Refractor is a multitouch interface for transforming and distorting images.
How to install
Refractor is based on web standards, so it should just run in Safari on iPad. But Apple unfortunately doesn't (yet) allow WebGL to run on iOS. Unless it's in an iAd!
Fortunately it's not too difficult to run Refractor as an iAd.
- Download Apple's iAd Tester app. Click this link on your iPad.
- Download this zip file to your computer.
- Connect your iPad to your computer and open iTunes.
- Go to Apps > File Sharing > iAd Tester. Drag the zip file into iAd Tester Documents.
- The file should transfer, then disappear. You can now open iAd Tester and run Refractor!
GLSL code is dynamically generated by the sequence of distortions you chain together.
The distortions themselves are just primitive GLSL functions:
Each distortion is sandwiched by an affine transformation first, and then its inverse transformation afterwards. In effect, this sandwiching lets us change the reference frame for the distortion.
The transformations are modeled as 3x3 matrices and sent in to the shader as uniforms. The matrices are manipulated by multi-touching the image.