[cogl] debug: don't overlay wireframe
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] debug: don't overlay wireframe
- Date: Thu, 9 Feb 2012 16:09:38 +0000 (UTC)
commit 269878217f6b2bfdd2b59425f2a9d3e0b6ce4c42
Author: Robert Bragg <robert linux intel com>
Date: Mon Jan 9 11:57:01 2012 +0000
debug: don't overlay wireframe
When using COGL_DEBUG=wireframe we were overlaying a wireframe of the
users geometry over the top of what was drawn for each primitive. It
seems to be more useful though that if the wireframe debug option has
been enabled then we should draw only the wireframes instead of
overlaying them.
Reviewed-by: Neil Roberts <neil linux intel com>
cogl/cogl-framebuffer.c | 86 ++++++++++++++++++++++++----------------------
1 files changed, 45 insertions(+), 41 deletions(-)
---
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index b3d1753..a90ce06 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -2678,18 +2678,20 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
int n_attributes,
CoglDrawFlags flags)
{
- _cogl_flush_attributes_state (framebuffer, pipeline, flags,
- attributes, n_attributes);
-
- GE (framebuffer->context,
- glDrawArrays ((GLenum)mode, first_vertex, n_vertices));
-
#ifdef COGL_ENABLE_DEBUG
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
draw_wireframe (framebuffer, pipeline,
mode, first_vertex, n_vertices,
attributes, n_attributes, NULL);
+ else
#endif
+ {
+ _cogl_flush_attributes_state (framebuffer, pipeline, flags,
+ attributes, n_attributes);
+
+ GE (framebuffer->context,
+ glDrawArrays ((GLenum)mode, first_vertex, n_vertices));
+ }
}
void
@@ -2769,47 +2771,49 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
int n_attributes,
CoglDrawFlags flags)
{
- CoglBuffer *buffer;
- guint8 *base;
- size_t buffer_offset;
- size_t index_size;
- GLenum indices_gl_type = 0;
-
- _cogl_flush_attributes_state (framebuffer, pipeline, flags,
- attributes, n_attributes);
-
- buffer = COGL_BUFFER (cogl_indices_get_buffer (indices));
- base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_BUFFER);
- buffer_offset = cogl_indices_get_offset (indices);
- index_size = sizeof_index_type (cogl_indices_get_type (indices));
-
- switch (cogl_indices_get_type (indices))
- {
- case COGL_INDICES_TYPE_UNSIGNED_BYTE:
- indices_gl_type = GL_UNSIGNED_BYTE;
- break;
- case COGL_INDICES_TYPE_UNSIGNED_SHORT:
- indices_gl_type = GL_UNSIGNED_SHORT;
- break;
- case COGL_INDICES_TYPE_UNSIGNED_INT:
- indices_gl_type = GL_UNSIGNED_INT;
- break;
- }
-
- GE (framebuffer->context,
- glDrawElements ((GLenum)mode,
- n_vertices,
- indices_gl_type,
- base + buffer_offset + index_size * first_vertex));
-
- _cogl_buffer_unbind (buffer);
-
#ifdef COGL_ENABLE_DEBUG
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
draw_wireframe (framebuffer, pipeline,
mode, first_vertex, n_vertices,
attributes, n_attributes, indices);
+ else
#endif
+ {
+ CoglBuffer *buffer;
+ guint8 *base;
+ size_t buffer_offset;
+ size_t index_size;
+ GLenum indices_gl_type = 0;
+
+ _cogl_flush_attributes_state (framebuffer, pipeline, flags,
+ attributes, n_attributes);
+
+ buffer = COGL_BUFFER (cogl_indices_get_buffer (indices));
+ base = _cogl_buffer_bind (buffer, COGL_BUFFER_BIND_TARGET_INDEX_BUFFER);
+ buffer_offset = cogl_indices_get_offset (indices);
+ index_size = sizeof_index_type (cogl_indices_get_type (indices));
+
+ switch (cogl_indices_get_type (indices))
+ {
+ case COGL_INDICES_TYPE_UNSIGNED_BYTE:
+ indices_gl_type = GL_UNSIGNED_BYTE;
+ break;
+ case COGL_INDICES_TYPE_UNSIGNED_SHORT:
+ indices_gl_type = GL_UNSIGNED_SHORT;
+ break;
+ case COGL_INDICES_TYPE_UNSIGNED_INT:
+ indices_gl_type = GL_UNSIGNED_INT;
+ break;
+ }
+
+ GE (framebuffer->context,
+ glDrawElements ((GLenum)mode,
+ n_vertices,
+ indices_gl_type,
+ base + buffer_offset + index_size * first_vertex));
+
+ _cogl_buffer_unbind (buffer);
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]