Support transparent textures
parent
77bd45b977
commit
e991ab5c6d
|
@ -9,4 +9,6 @@ uniform sampler2D texture0;
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
outColor = texture(texture0, fragmentTextureCoords);
|
outColor = texture(texture0, fragmentTextureCoords);
|
||||||
|
if (outColor.a == 0.0)
|
||||||
|
discard;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ static void *create_texture(void *key)
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture->width, texture->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||||
glGenerateMipmap(GL_TEXTURE_2D);
|
glGenerateMipmap(GL_TEXTURE_2D);
|
||||||
|
|
||||||
stbi_image_free(data);
|
stbi_image_free(data);
|
||||||
|
|
Loading…
Reference in New Issue