OpenGL2: Use an OpenGL 3.2 core context if available.
This commit is contained in:
parent
51ca4d35ea
commit
d549b642bc
20 changed files with 313 additions and 349 deletions
|
@ -1,5 +1,7 @@
|
|||
uniform sampler2D u_DiffuseMap;
|
||||
|
||||
uniform int u_AlphaTest;
|
||||
|
||||
varying vec2 var_Tex1;
|
||||
varying vec4 var_Color;
|
||||
|
||||
|
@ -8,5 +10,23 @@ void main()
|
|||
{
|
||||
vec4 color = texture2D(u_DiffuseMap, var_Tex1);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue