Skip to content

Commit

Permalink
Clamp textures with alpha to transparent color
Browse files Browse the repository at this point in the history
  • Loading branch information
sarbes committed Jun 13, 2022
1 parent 7406342 commit 0cd17af
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions xbmc/guilib/TextureGL.cpp
Expand Up @@ -88,8 +88,27 @@ void CGLTexture::LoadToGPU()
}

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

#ifdef HAS_GL
if (HasAlpha())
#else
if (HasAlpha() &&
(CServiceBroker::GetRenderSystem()->IsExtSupported("GL_OES_texture_border_clamp") ||
CServiceBroker::GetRenderSystem()->IsExtSupported("GL_EXT_texture_border_clamp") ||
CServiceBroker::GetRenderSystem()->IsExtSupported("GL_NV_texture_border_clamp")))
#endif
{
float color[] = {0.0f, 0.0f, 0.0f, 0.0f};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, color);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
}
else
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
}

unsigned int maxSize = CServiceBroker::GetRenderSystem()->GetMaxTextureSize();
if (m_textureHeight > maxSize)
Expand Down

0 comments on commit 0cd17af

Please sign in to comment.