Last active
August 29, 2015 14:05
-
-
Save danzeeeman/b0b1a2a5174f7da45d0a to your computer and use it in GitHub Desktop.
AlphaTest for openGL ES2
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
alphatest.frag | |
======= | |
precision highp float; | |
uniform sampler2D tex0; | |
uniform float alpha; | |
varying vec2 texCoordVarying; | |
void main() | |
{ | |
vec4 texel0 = texture2D(tex0, texCoordVarying); | |
if(texel0.a > 0.1){ | |
gl_FragColor = vec4(texel0.rgb, alpha); | |
}else{ | |
discard; | |
} | |
} | |
alphatest.vert | |
======= | |
uniform mat4 modelViewProjectionMatrix; | |
attribute vec4 position; | |
attribute vec2 texcoord; | |
varying vec2 texCoordVarying; | |
void main() | |
{ | |
texCoordVarying = texcoord; | |
gl_Position = modelViewProjectionMatrix * position; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment