Skip to content

falcon11/glslsandbox-ios

Repository files navigation

glslsandbox-ios

Overview

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.

Add new Fragment Shader

  1. copy fragment shader source code from glslsandbox
  2. 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);
    }
  3. in GLSLSandboxListViewController.m file, add the fragment shader source file name to the sandboxDemosList.
  4. run the project you will find the new demo in the demo list.

Demo Snapshot

Releases

No releases published

Packages

No packages published