mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-06 17:41:04 +00:00
Fix GLES2 discard behaviour (texture transparency)
This commit is contained in:
parent
d1e0f73b77
commit
ea250ff5c5
3 changed files with 18 additions and 8 deletions
|
@ -328,13 +328,16 @@ void main(void)
|
|||
vec2 uv = varTexCoord.st;
|
||||
vec4 base = texture2D(baseTexture, uv).rgba;
|
||||
|
||||
#ifdef USE_DISCARD
|
||||
// If alpha is zero, we can just discard the pixel. This fixes transparency
|
||||
// on GPUs like GC7000L, where GL_ALPHA_TEST is not implemented in mesa,
|
||||
// and also on GLES 2, where GL_ALPHA_TEST is missing entirely.
|
||||
if (base.a == 0.0) {
|
||||
#ifdef USE_DISCARD
|
||||
if (base.a == 0.0)
|
||||
discard;
|
||||
#endif
|
||||
#ifdef USE_DISCARD_REF
|
||||
if (base.a < 0.5)
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
|
||||
color = base.rgb;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue