[vlc-devel] [PATCH] opengl: fix matrix multiplication order

Romain Vimont rom1v at videolabs.io
Sat Jan 25 17:09:05 CET 2020


The orientation matrix must be applied on the input coordinates, before
the (internal) Android transformation, which depends on how the texture
is actually stored.

For example, if the orientation matrix represents a vertical flip,
"vertical" is only meaningful on the input coordinates (if the Android
transformation rotates by 90°, the vertical flip would result in an
horizontal flip instead).

The first version was actually correct:
<https://mailman.videolan.org/pipermail/vlc-devel/2019-December/130153.html>
---
 modules/video_output/opengl/vout_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index af2fd80bc0..a9fa1b8da4 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -322,7 +322,7 @@ static GLuint BuildVertexShader(const opengl_tex_converter_t *tc,
         "uniform mat4 ZoomMatrix;\n"
         "uniform mat4 ViewMatrix;\n"
         "void main() {\n"
-        " TexCoord0 = vec4(OrientationMatrix * TransformMatrix * MultiTexCoord0).st;\n"
+        " TexCoord0 = vec4(TransformMatrix * OrientationMatrix * MultiTexCoord0).st;\n"
         "%s%s"
         " gl_Position = ProjectionMatrix * ZoomMatrix * ViewMatrix\n"
         "               * vec4(VertexPosition, 1.0);\n"
-- 
2.25.0



More information about the vlc-devel mailing list