From 1d86b04e0644db63ac3fe0635667fc3792c4e691 Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Wed, 28 Jan 2009 13:46:39 +0000 Subject: [PATCH] Adds some debug code to _cogl_journal_flush_quad_batch 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. --- gl/cogl-texture.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/gl/cogl-texture.c b/gl/cogl-texture.c index 2b25fafc0..0c9315ed4 100644 --- a/gl/cogl-texture.c +++ b/gl/cogl-texture.c @@ -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