Native iOS implementation of glslsandbox, using GPUImage.
You can run most Fragment Shader copied from glslsandox or ShaderToy without modification or just a little modification.
- copy fragment shader source code from glslsandbox
- create a new fragment shader source file under FragmentShader folder, then past code copied from last step. If you copy shader from ShaderToy, you need to modify the file.
// add below lines at begining #ifdef GL_ES precision mediump float; #endif uniform float time; uniform vec3 mouse; uniform vec2 resolution; // shadertoy emulation #define iTime time #define iResolution resolution #define iMouse mouse // add below lines at end // --------[ Original ShaderToy ends here ]---------- // void main(void) { mainImage(gl_FragColor, gl_FragCoord.xy); }
- in GLSLSandboxListViewController.m file, add the fragment shader source file name to the
sandboxDemosList
. - run the project you will find the new demo in the demo list.