From 09684bb1dc08495594104a939026d8722ab7b088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 15 Mar 2016 17:15:09 +0100 Subject: [PATCH] [core] do not paint empty debug buckets this removes "Buffer doesn't contain elements" messages when debug painting is enabled --- src/mbgl/renderer/debug_bucket.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mbgl/renderer/debug_bucket.cpp b/src/mbgl/renderer/debug_bucket.cpp index 947783ddb..ba4ab8c92 100644 --- a/src/mbgl/renderer/debug_bucket.cpp +++ b/src/mbgl/renderer/debug_bucket.cpp @@ -31,11 +31,15 @@ DebugBucket::DebugBucket(const TileID id, const TileData::State state_, optional } void DebugBucket::drawLines(PlainShader& shader, gl::GLObjectStore& glObjectStore) { - array.bind(shader, fontBuffer, BUFFER_OFFSET_0, glObjectStore); - MBGL_CHECK_ERROR(glDrawArrays(GL_LINES, 0, (GLsizei)(fontBuffer.index()))); + if (!fontBuffer.empty()) { + array.bind(shader, fontBuffer, BUFFER_OFFSET_0, glObjectStore); + MBGL_CHECK_ERROR(glDrawArrays(GL_LINES, 0, (GLsizei)(fontBuffer.index()))); + } } void DebugBucket::drawPoints(PlainShader& shader, gl::GLObjectStore& glObjectStore) { - array.bind(shader, fontBuffer, BUFFER_OFFSET_0, glObjectStore); - MBGL_CHECK_ERROR(glDrawArrays(GL_POINTS, 0, (GLsizei)(fontBuffer.index()))); + if (!fontBuffer.empty()) { + array.bind(shader, fontBuffer, BUFFER_OFFSET_0, glObjectStore); + MBGL_CHECK_ERROR(glDrawArrays(GL_POINTS, 0, (GLsizei)(fontBuffer.index()))); + } }