Fixed bug 4025 - SDL_Renderer OpenGL : add support for textures ABGR, RGB, BGR

Sylvain

OpenGLES2 SDL renderer has support for textures ARGB, ABGR, RGB and BGR, whereas OpenGL SDL renderer only had ARGB.

If you think it's worth adding it, here's a patch. I quickly tried and it worked, but there may be missing things or corner case.
This commit is contained in:
Sam Lantinga 2019-05-19 11:01:36 -07:00
parent 8dea23c705
commit 2ee9b1ddce
3 changed files with 39 additions and 3 deletions

View file

@ -240,6 +240,23 @@ static const char *shader_source[NUM_SHADERS][2] =
"\n"
"void main()\n"
"{\n"
" gl_FragColor = texture2D(tex0, v_texCoord);\n"
" gl_FragColor.a = 1.0;\n"
" gl_FragColor *= v_color;\n"
"}"
},
/* SHADER_RGBA */
{
/* vertex shader */
TEXTURE_VERTEX_SHADER,
/* fragment shader */
"varying vec4 v_color;\n"
"varying vec2 v_texCoord;\n"
"uniform sampler2D tex0;\n"
"\n"
"void main()\n"
"{\n"
" gl_FragColor = texture2D(tex0, v_texCoord) * v_color;\n"
"}"
},