ES-DE/resources/shaders/glsl/bgra_to_rgba.glsl
Leon Styhre 0c552dd8fb Added a GLSL shader to convert the color model BGRA to RGBA.
Also added support for specifying a separate format as compared to internalFormat when creating textures, although the shader should be used primarily as this is not really supported by the OpenGL standard.
2022-01-07 18:54:52 +01:00

34 lines
561 B
GLSL

// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// bgra_to_rgba.glsl
//
// Convert from color model BGRA to RGBA.
//
#if defined(VERTEX)
// Vertex section of code:
uniform mat4 MVPMatrix;
varying vec2 vTexCoord;
void main(void)
{
vTexCoord = gl_MultiTexCoord0.xy;
gl_Position = MVPMatrix * gl_Vertex;
}
#elif defined(FRAGMENT)
// Fragment section of code:
uniform sampler2D myTexture;
varying vec2 vTexCoord;
void main()
{
vec4 color = texture2D(myTexture, vTexCoord);
gl_FragColor = vec4(color.bgra);
}
#endif