[vlc-commits] OpenGL: take planes in account in DrawWithShaders

Nicolas Bertrand git at videolan.org
Tue Jul 9 16:04:24 CEST 2013


vlc | branch: master | Nicolas Bertrand <nicoinattendu at gmail.com> | Tue Jul  9 15:59:24 2013 +0200| [a27daf2042969769d92d7c192d7f679a5c20b9f7] | committer: Jean-Baptiste Kempf

OpenGL: take planes in account in DrawWithShaders

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a27daf2042969769d92d7c192d7f679a5c20b9f7
---

 modules/video_output/opengl.c |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/opengl.c b/modules/video_output/opengl.c
index 735c591..a0d915d 100644
--- a/modules/video_output/opengl.c
+++ b/modules/video_output/opengl.c
@@ -923,10 +923,15 @@ static void DrawWithShaders(vout_display_opengl_t *vgl,
 {
     vgl->UseProgram(vgl->program[program]);
     if (program == 0) {
-        vgl->Uniform4fv(vgl->GetUniformLocation(vgl->program[0], "Coefficient"), 4, vgl->local_value);
-        vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[0], "Texture0"), 0);
-        vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[0], "Texture1"), 1);
-        vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[0], "Texture2"), 2);
+        if (vgl->chroma->plane_count == 3) {
+            vgl->Uniform4fv(vgl->GetUniformLocation(vgl->program[0], "Coefficient"), 4, vgl->local_value);
+            vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[0], "Texture0"), 0);
+            vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[0], "Texture1"), 1);
+            vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[0], "Texture2"), 2);
+        }
+        else if (vgl->chroma->plane_count == 1) {
+            vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[0], "Texture0"), 0);
+        }
     } else {
         vgl->Uniform1i(vgl->GetUniformLocation(vgl->program[1], "Texture0"), 0);
         vgl->Uniform4f(vgl->GetUniformLocation(vgl->program[1], "FillColor"), 1.0f, 1.0f, 1.0f, 1.0f);
@@ -1000,7 +1005,7 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
     }
 
 #ifdef SUPPORTS_SHADERS
-    if (vgl->program[0] && vgl->chroma->plane_count == 3)
+    if (vgl->program[0] && (vgl->chroma->plane_count == 3 || vgl->chroma->plane_count == 1))
         DrawWithShaders(vgl, left, top, right, bottom, 0);
     else if (vgl->program[1] && vgl->chroma->plane_count == 1)
         DrawWithShaders(vgl, left, top, right, bottom, 1);



More information about the vlc-commits mailing list