[Cogl] [PATCH] examples: Fix the first colour in the triangle_vertices

Neil Roberts neil at linux.intel.com
Fri Apr 19 09:58:54 PDT 2013


The first vertex in the triangle vertices used in the cogl-hello
example (which were copied into a few other examples) for some reason
has a semi-transparent alpha component. However the colour needs to be
pre-multiplied and the red component was still 0xff so the colour is
effectively invalid and the transparency isn't shown. This patch just
sets the alpha component to 0xff to make it less confusing.
---
 examples/android/hello/jni/main.c | 2 +-
 examples/cogl-gles2-context.c     | 2 +-
 examples/cogl-hello.c             | 2 +-
 examples/cogl-msaa.c              | 2 +-
 examples/cogl-sdl-hello.c         | 2 +-
 examples/cogl-sdl2-hello.c        | 2 +-
 examples/cogl-x11-foreign.c       | 2 +-
 examples/cogland.c                | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/examples/android/hello/jni/main.c b/examples/android/hello/jni/main.c
index 2c5bd9b..c9a8401 100644
--- a/examples/android/hello/jni/main.c
+++ b/examples/android/hello/jni/main.c
@@ -42,7 +42,7 @@ static int test_init (TestData* data)
   CoglOnscreen *onscreen;
   CoglError *error = NULL;
   CoglVertexP2C4 triangle_vertices[] = {
-        {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+        {0, 0.7, 0xff, 0x00, 0x00, 0xff},
         {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
         {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
   };
diff --git a/examples/cogl-gles2-context.c b/examples/cogl-gles2-context.c
index 68e7503..73afbbf 100644
--- a/examples/cogl-gles2-context.c
+++ b/examples/cogl-gles2-context.c
@@ -70,7 +70,7 @@ main (int argc, char **argv)
     CoglOnscreen *onscreen;
     CoglError *error = NULL;
     CoglVertexP2C4 triangle_vertices[] = {
-        {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+        {0, 0.7, 0xff, 0x00, 0x00, 0xff},
         {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
         {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
     };
diff --git a/examples/cogl-hello.c b/examples/cogl-hello.c
index 5bda9bf..3ba1e31 100644
--- a/examples/cogl-hello.c
+++ b/examples/cogl-hello.c
@@ -39,7 +39,7 @@ main (int argc, char **argv)
     CoglOnscreen *onscreen;
     CoglError *error = NULL;
     CoglVertexP2C4 triangle_vertices[] = {
-        {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+        {0, 0.7, 0xff, 0x00, 0x00, 0xff},
         {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
         {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
     };
diff --git a/examples/cogl-msaa.c b/examples/cogl-msaa.c
index 9697637..5e7412f 100644
--- a/examples/cogl-msaa.c
+++ b/examples/cogl-msaa.c
@@ -12,7 +12,7 @@ main (int argc, char **argv)
     CoglFramebuffer *fb;
     CoglError *error = NULL;
     CoglVertexP2C4 triangle_vertices[] = {
-        {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+        {0, 0.7, 0xff, 0x00, 0x00, 0xff},
         {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
         {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
     };
diff --git a/examples/cogl-sdl-hello.c b/examples/cogl-sdl-hello.c
index 961137a..acb9125 100644
--- a/examples/cogl-sdl-hello.c
+++ b/examples/cogl-sdl-hello.c
@@ -80,7 +80,7 @@ main (int argc, char **argv)
   CoglOnscreen *onscreen;
   CoglError *error = NULL;
   CoglVertexP2C4 triangle_vertices[] = {
-    {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+    {0, 0.7, 0xff, 0x00, 0x00, 0xff},
     {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
     {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
   };
diff --git a/examples/cogl-sdl2-hello.c b/examples/cogl-sdl2-hello.c
index 405cb92..12e6ced 100644
--- a/examples/cogl-sdl2-hello.c
+++ b/examples/cogl-sdl2-hello.c
@@ -89,7 +89,7 @@ main (int argc, char **argv)
   CoglOnscreen *onscreen;
   CoglError *error = NULL;
   CoglVertexP2C4 triangle_vertices[] = {
-    {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+    {0, 0.7, 0xff, 0x00, 0x00, 0xff},
     {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
     {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
   };
diff --git a/examples/cogl-x11-foreign.c b/examples/cogl-x11-foreign.c
index 849646c..e9ac93d 100644
--- a/examples/cogl-x11-foreign.c
+++ b/examples/cogl-x11-foreign.c
@@ -61,7 +61,7 @@ main (int argc, char **argv)
   unsigned long mask;
   Window xwin;
   CoglVertexP2C4 triangle_vertices[] = {
-      {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+      {0, 0.7, 0xff, 0x00, 0x00, 0xff},
       {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
       {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
   };
diff --git a/examples/cogland.c b/examples/cogland.c
index e6d31b3..dc798d7 100644
--- a/examples/cogland.c
+++ b/examples/cogland.c
@@ -1051,7 +1051,7 @@ main (int argc, char **argv)
   CoglError *error = NULL;
   GError *gerror = NULL;
   CoglVertexP2C4 triangle_vertices[] = {
-      {0, 0.7, 0xff, 0x00, 0x00, 0x80},
+      {0, 0.7, 0xff, 0x00, 0x00, 0xff},
       {-0.7, -0.7, 0x00, 0xff, 0x00, 0xff},
       {0.7, -0.7, 0x00, 0x00, 0xff, 0xff}
   };
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list