Created
April 8, 2016 02:07
-
-
Save OnlyInAmerica/f0f62c44c6acfb4b7e6f245de5ddd01b to your computer and use it in GitHub Desktop.
A Vertex shader that mirrors its source horizontally
This file contains 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
private static final String FRAGMENT_SHADER_MIRROR = | |
"#extension GL_OES_EGL_image_external : require\n" + | |
"precision mediump float;\n" + | |
"varying vec2 vTextureCoord;\n" + // Coordinate within texture | |
"uniform samplerExternalOES sTexture;\n" + // Texture | |
"uniform vec2 uPosition;\n" + // Position within OpenGL scene | |
"void main() {\n" + | |
" vec2 texCoord = vTextureCoord.xy;\n" + | |
" vec2 normCoord = 2.0 * texCoord - 1.0;\n"+ | |
" normCoord.x = normCoord.x * sign(normCoord.x + uPosition.x);\n"+ | |
" texCoord = normCoord / 2.0 + 0.5;\n"+ | |
" gl_FragColor = texture2D(sTexture, texCoord);\n"+ | |
"}\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment