[Cogl] [PATCH 07/15] cogl-gst: Use alpha textures instead of luminance textures

Lionel Landwerlin llandwerlin at gmail.com
Sat Jun 22 01:58:51 PDT 2013


From: Neil Roberts <neil at linux.intel.com>

Luminance textures are not supported on GL3 and as the textures are
accessed via a shader anyway it doesn't seem like it should make much
difference which component the single-component textures are in. Cogl
already has code to fake alpha textures via the texture swizzle
extension on GL3.

Reviewed-by: Robert Bragg <robert at linux.intel.com>

(cherry picked from commit ca1666860a325fa4d2362cdd38297d6281e997d8)
---
 cogl-gst/cogl-gst-shader.c     | 6 +++---
 cogl-gst/cogl-gst-video-sink.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cogl-gst/cogl-gst-shader.c b/cogl-gst/cogl-gst-shader.c
index bc11f18..49d4671 100644
--- a/cogl-gst/cogl-gst-shader.c
+++ b/cogl-gst/cogl-gst-shader.c
@@ -49,9 +49,9 @@ _cogl_gst_shader_yv12_to_rgba_decl[] =
   "vec4\n"
   "cogl_gst_sample_video (vec2 UV)\n"
   "{\n"
-  "  float y = 1.1640625 * (texture2D (cogl_sampler0, UV).g - 0.0625);\n"
-  "  float u = texture2D (cogl_sampler1, UV).g - 0.5;\n"
-  "  float v = texture2D (cogl_sampler2, UV).g - 0.5;\n"
+  "  float y = 1.1640625 * (texture2D (cogl_sampler0, UV).a - 0.0625);\n"
+  "  float u = texture2D (cogl_sampler1, UV).a - 0.5;\n"
+  "  float v = texture2D (cogl_sampler2, UV).a - 0.5;\n"
   "  vec4 color;\n"
   "  color.r = y + 1.59765625 * v;\n"
   "  color.g = y - 0.390625 * u - 0.8125 * v;\n"
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 2ff27d0..8b97ef6 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -428,7 +428,7 @@ cogl_gst_yv12_upload (CoglGstVideoSink *sink,
 {
   CoglGstVideoSinkPrivate *priv = sink->priv;
   GstVideoFrame frame;
-  CoglPixelFormat format = COGL_PIXEL_FORMAT_G_8;
+  CoglPixelFormat format = COGL_PIXEL_FORMAT_A_8;
 
   if (!gst_video_frame_map (&frame, &priv->info, buffer, GST_MAP_READ))
     goto map_fail;
-- 
1.8.3.1



More information about the Cogl mailing list