1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Fix monochrome shaders for GLES2

This commit is contained in:
Francisco Zurita 2017-02-05 01:38:48 -05:00 committed by Sergey Lipskiy
parent 15f90a0699
commit 341f9848bb

View File

@ -89,18 +89,32 @@ namespace glsl {
public: public:
MonochromeFragmentShader(const opengl::GLInfo & _glinfo) MonochromeFragmentShader(const opengl::GLInfo & _glinfo)
{ {
m_part = if (_glinfo.isGLES2) {
"uniform sampler2D uColorImage; \n" m_part =
"OUT lowp vec4 fragColor; \n" "uniform sampler2D uColorImage; \n"
"void main() \n" "uniform mediump vec2 uScreenSize; \n"
"{ \n" "void main() \n"
" mediump ivec2 coord = ivec2(gl_FragCoord.xy); \n" "{ \n"
" lowp vec4 tex = texelFetch(uColorImage, coord, 0); \n" " mediump vec2 coord = gl_FragCoord.xy/uScreenSize; \n"
//" lowp float c = (tex.r + tex.g + tex.b) / 3.0f; \n" " lowp vec4 tex = texture2D(uColorImage, coord); \n"
" lowp float c = dot(vec4(0.2126, 0.7152, 0.0722, 0.0), tex);\n" " lowp float c = dot(vec4(0.2126, 0.7152, 0.0722, 0.0), tex); \n"
" fragColor = vec4(c, c, c, 1.0); \n" " gl_FragColor = vec4(c, c, c, 1.0); \n"
"} \n" "} \n"
; ;
} else {
m_part =
"uniform sampler2D uColorImage; \n"
"OUT lowp vec4 fragColor; \n"
"void main() \n"
"{ \n"
" mediump ivec2 coord = ivec2(gl_FragCoord.xy); \n"
" lowp vec4 tex = texelFetch(uColorImage, coord, 0); \n"
//" lowp float c = (tex.r + tex.g + tex.b) / 3.0f; \n"
" lowp float c = dot(vec4(0.2126, 0.7152, 0.0722, 0.0), tex);\n"
" fragColor = vec4(c, c, c, 1.0); \n"
"} \n"
;
}
} }
}; };