Created
February 8, 2017 09:48
-
-
Save thieux/0a0de2eaed97f3d252f690b908247de9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifdef GL_ES | |
| precision mediump float; | |
| #endif | |
| uniform float time; | |
| uniform vec2 mouse; | |
| uniform vec2 resolution; | |
| void red() { | |
| if (gl_FragCoord.y < 100.0) { | |
| gl_FragColor = vec4(1, 0, 0, cos(time)); | |
| } | |
| else { | |
| gl_FragColor = vec4(0, 0, 0, 1.0); | |
| } | |
| } | |
| void green() { | |
| if (gl_FragCoord.y < 100.0) { | |
| gl_FragColor = vec4(0, 1, 0, 1.0); | |
| } | |
| else { | |
| gl_FragColor = vec4(0, 0, 0, 1.0); | |
| } | |
| } | |
| void printResult(bool result) { | |
| if (result) { | |
| red(); | |
| } else { | |
| green(); | |
| } | |
| } | |
| void main( void ) { | |
| mediump float delta = 20.0; | |
| mediump float top = 200.0; | |
| mediump float bottom = top-delta; | |
| if (gl_FragCoord.x > bottom && gl_FragCoord.x < top && gl_FragCoord.y > bottom && gl_FragCoord.y < top) { | |
| if (gl_FragColor.x == 1.0) { | |
| gl_FragColor = vec4(1, 0, 0, 1.0); | |
| } else { | |
| gl_FragColor = vec4(0, 1, 0, 1.0); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment