From c615807bc420d3ce8fe2091ae99789077cb094a1 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 3 Aug 2021 12:02:55 +0300 Subject: qcam: Support OpenGL ES 2.0 The GL_RG and GL_RED texture formats are not supported in OpenGL ES prior to 3.0. In order to be compatible with OpenGL ES 2.0, use GL_LUMINANCE_ALPHA and GL_LUMINANCE instead. The shader code needs to be updated accordingly for GL_RG, as the second component is now stored in the alpha component instead of the green component. Usage of the red component is fine, the luminance value is stored in the red, green and blue components. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Andrey Konovalov --- src/qcam/assets/shader/YUV_2_planes.frag | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/qcam/assets') diff --git a/src/qcam/assets/shader/YUV_2_planes.frag b/src/qcam/assets/shader/YUV_2_planes.frag index 125f1c85..254463c0 100644 --- a/src/qcam/assets/shader/YUV_2_planes.frag +++ b/src/qcam/assets/shader/YUV_2_planes.frag @@ -26,9 +26,9 @@ void main(void) yuv.x = texture2D(tex_y, textureOut).r - 0.063; #if defined(YUV_PATTERN_UV) yuv.y = texture2D(tex_u, textureOut).r - 0.500; - yuv.z = texture2D(tex_u, textureOut).g - 0.500; + yuv.z = texture2D(tex_u, textureOut).a - 0.500; #elif defined(YUV_PATTERN_VU) - yuv.y = texture2D(tex_u, textureOut).g - 0.500; + yuv.y = texture2D(tex_u, textureOut).a - 0.500; yuv.z = texture2D(tex_u, textureOut).r - 0.500; #else #error Invalid pattern -- cgit v1.2.1