mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-19 13:25:38 +00:00
Added opacity support to the BGRA to RGBA shader.
This commit is contained in:
parent
f585f87497
commit
69c1a1259d
|
@ -363,6 +363,8 @@ namespace Renderer
|
||||||
if (runShader) {
|
if (runShader) {
|
||||||
runShader->activateShaders();
|
runShader->activateShaders();
|
||||||
runShader->setModelViewProjectionMatrix(getProjectionMatrix() * trans);
|
runShader->setModelViewProjectionMatrix(getProjectionMatrix() * trans);
|
||||||
|
if (vertices->opacity < 1.0f)
|
||||||
|
runShader->setOpacity(vertices->opacity);
|
||||||
GL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, numVertices));
|
GL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, numVertices));
|
||||||
runShader->deactivateShaders();
|
runShader->deactivateShaders();
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,14 @@ void main(void)
|
||||||
#elif defined(FRAGMENT)
|
#elif defined(FRAGMENT)
|
||||||
// Fragment section of code:
|
// Fragment section of code:
|
||||||
|
|
||||||
|
uniform float opacity = 1.0;
|
||||||
uniform sampler2D myTexture;
|
uniform sampler2D myTexture;
|
||||||
varying vec2 vTexCoord;
|
varying vec2 vTexCoord;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 color = texture2D(myTexture, vTexCoord);
|
vec4 color = texture2D(myTexture, vTexCoord);
|
||||||
gl_FragColor = vec4(color.bgra);
|
gl_FragColor = vec4(color.bgr, color.a * opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue