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>
This commit is contained in:
Robert Bragg 2012-01-09 11:57:01 +00:00
parent 983c9f0dc4
commit 269878217f

View File

@ -2678,18 +2678,20 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
int n_attributes, int n_attributes,
CoglDrawFlags flags) 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 #ifdef COGL_ENABLE_DEBUG
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME))) if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
draw_wireframe (framebuffer, pipeline, draw_wireframe (framebuffer, pipeline,
mode, first_vertex, n_vertices, mode, first_vertex, n_vertices,
attributes, n_attributes, NULL); attributes, n_attributes, NULL);
else
#endif #endif
{
_cogl_flush_attributes_state (framebuffer, pipeline, flags,
attributes, n_attributes);
GE (framebuffer->context,
glDrawArrays ((GLenum)mode, first_vertex, n_vertices));
}
} }
void void
@ -2769,6 +2771,14 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
int n_attributes, int n_attributes,
CoglDrawFlags flags) CoglDrawFlags flags)
{ {
#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; CoglBuffer *buffer;
guint8 *base; guint8 *base;
size_t buffer_offset; size_t buffer_offset;
@ -2803,13 +2813,7 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
base + buffer_offset + index_size * first_vertex)); base + buffer_offset + index_size * first_vertex));
_cogl_buffer_unbind (buffer); _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);
#endif
} }
void void