OpenGL2: Use an OpenGL 3.2 core context if available.
This commit is contained in:
1 parent
51ca4d35ea
commit
d549b642bc
20 files changed
+313
-349
No files matched your search
@@ -1,5 +1,7 @@
|
||||
uniform sampler2D u_DiffuseMap;
|
||||
|
||||
uniform int u_AlphaTest;
|
||||
|
||||
varying vec2 var_DiffuseTex;
|
||||
|
||||
varying vec4 var_Color;
|
||||
@@ -8,5 +10,24 @@ varying vec4 var_Color;
|
||||
void main()
|
||||
{
|
||||
vec4 color = texture2D(u_DiffuseMap, var_DiffuseTex);
|
||||
gl_FragColor = color * var_Color;
|
||||
|
||||
float alpha = color.a * var_Color.a;
|
||||
if (u_AlphaTest == 1)
|
||||
{
|
||||
if (alpha == 0.0)
|
||||
discard;
|
||||
}
|
||||
else if (u_AlphaTest == 2)
|
||||
{
|
||||
if (alpha >= 0.5)
|
||||
discard;
|
||||
}
|
||||
else if (u_AlphaTest == 3)
|
||||
{
|
||||
if (alpha < 0.5)
|
||||
discard;
|
||||
}
|
||||
|
||||
gl_FragColor.rgb = color.rgb * var_Color.rgb;
|
||||
gl_FragColor.a = alpha;
|
||||
}
|
||||
Reference in new issue
Block a user