Created
February 27, 2014 03:20
-
-
Save lewkoo/9243762 to your computer and use it in GitHub Desktop.
Fragment shader for a very simple Android shader example
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
| precision highp float; | |
| void main() | |
| { | |
| // gl_FragCoord contains the window relative coordinate for the fragment. | |
| // we use gl_FragCoord.x position to control the red color value. | |
| // we use gl_FragCoord.y position to control the green color value. | |
| // please note that all r, g, b, a values are between 0 and 1. | |
| float windowWidth = 1024.0; | |
| float windowHeight = 768.0; | |
| float r = gl_FragCoord.x / windowWidth; | |
| float g = gl_FragCoord.y / windowHeight; | |
| float b = 1.0; | |
| float a = 1.0; | |
| gl_FragColor = vec4(r, g, b, a); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment