Adds some debug code to _cogl_journal_flush_quad_batch
authorRobert Bragg <robert@linux.intel.com>
Wed, 28 Jan 2009 13:46:39 +0000 (13:46 +0000)
committerRobert Bragg <robert@linux.intel.com>
Wed, 28 Jan 2009 17:20:15 +0000 (17:20 +0000)
The code is #if 0 guarded, but when uncommented it outlines all drawn
rectangles with an un-blended red, green or blue border. This may e.g. help
with debugging texture slicing issues or blending issues, plus it looks quite
cool.

clutter/cogl/gl/cogl-texture.c

index 2b25faf..0c9315e 100644 (file)
@@ -2051,6 +2051,33 @@ _cogl_journal_flush_quad_batch (CoglJournalEntry *batch_start,
                            6 * batch_len,
                            GL_UNSIGNED_SHORT,
                            ctx->static_indices->data));
+
+
+  /* DEBUGGING CODE XXX:
+   * Uncommenting this will cause all rectangles to be drawn with a red, green
+   * or blue outline with no blending. This may e.g. help with debugging
+   * texture slicing issues or blending issues, plus it looks quite cool.
+   */
+#if 0
+    {
+      static CoglHandle outline = COGL_INVALID_HANDLE;
+      static int color = 0;
+      if (outline == COGL_INVALID_HANDLE)
+        outline = cogl_material_new ();
+
+      cogl_enable (COGL_ENABLE_VERTEX_ARRAY);
+      for (i = 0; i < batch_len; i++, color = (++color) % 3)
+        {
+          cogl_material_set_color4ub (outline,
+                                      color == 0 ? 0xff : 0x00,
+                                      color == 1 ? 0xff : 0x00,
+                                      color == 2 ? 0xff : 0x00,
+                                      0xff);
+          cogl_material_flush_gl_state (outline, NULL);
+          GE( glDrawArrays (GL_LINE_LOOP, 4 * i, 4) );
+        }
+    }
+#endif
 }
 
 static void