Added opacity support to the BGRA to RGBA shader.

This commit is contained in:
Leon Styhre 2022-02-12 17:40:25 +01:00
parent f585f87497
commit 69c1a1259d
2 changed files with 4 additions and 1 deletions

View file

@ -363,6 +363,8 @@ namespace Renderer
if (runShader) {
runShader->activateShaders();
runShader->setModelViewProjectionMatrix(getProjectionMatrix() * trans);
if (vertices->opacity < 1.0f)
runShader->setOpacity(vertices->opacity);
GL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, numVertices));
runShader->deactivateShaders();
}

View file

@ -21,13 +21,14 @@ void main(void)
#elif defined(FRAGMENT)
// Fragment section of code:
uniform float opacity = 1.0;
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main()
{
vec4 color = texture2D(myTexture, vTexCoord);
gl_FragColor = vec4(color.bgra);
gl_FragColor = vec4(color.bgr, color.a * opacity);
}
#endif