diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-06-23 18:05:06 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-06-23 18:05:25 +0200 |
commit | ba4294ae0c06c1ed160f0be47863c9515da8d403 (patch) | |
tree | 5a16d8c200d21fbdf1bb0d91168452aea6142b90 /src/renderer/painter_debug.cpp | |
parent | f51fd9be585814dedf108cb6e81a674717e39fe6 (diff) | |
download | qtlocation-mapboxgl-ba4294ae0c06c1ed160f0be47863c9515da8d403.tar.gz |
saving current state
Diffstat (limited to 'src/renderer/painter_debug.cpp')
-rw-r--r-- | src/renderer/painter_debug.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/renderer/painter_debug.cpp b/src/renderer/painter_debug.cpp index 23bf32fdac..eb26b0b263 100644 --- a/src/renderer/painter_debug.cpp +++ b/src/renderer/painter_debug.cpp @@ -63,6 +63,10 @@ void Painter::renderDebugFrame() { } void Painter::renderDebugText(const std::vector<std::string> &strings) { + if (strings.empty()) { + return; + } + gl::group group("debug text"); glDisable(GL_DEPTH_TEST); @@ -78,20 +82,21 @@ void Painter::renderDebugText(const std::vector<std::string> &strings) { line += 20; } - // draw debug info - VertexArrayObject debugFontArray; - debugFontArray.bind(*plainShader, debugFontBuffer, BUFFER_OFFSET(0)); - plainShader->setColor(1.0f, 1.0f, 1.0f, 1.0f); - lineWidth(4.0f * map.getState().getPixelRatio()); - glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index()); -#ifndef GL_ES_VERSION_2_0 - glPointSize(2); - glDrawArrays(GL_POINTS, 0, (GLsizei)debugFontBuffer.index()); -#endif - plainShader->setColor(0.0f, 0.0f, 0.0f, 1.0f); - lineWidth(2.0f * map.getState().getPixelRatio()); - glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index()); - + if (!debugFontBuffer.empty()) { + // draw debug info + VertexArrayObject debugFontArray; + debugFontArray.bind(*plainShader, debugFontBuffer, BUFFER_OFFSET(0)); + plainShader->setColor(1.0f, 1.0f, 1.0f, 1.0f); + lineWidth(4.0f * map.getState().getPixelRatio()); + glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index()); + #ifndef GL_ES_VERSION_2_0 + glPointSize(2); + glDrawArrays(GL_POINTS, 0, (GLsizei)debugFontBuffer.index()); + #endif + plainShader->setColor(0.0f, 0.0f, 0.0f, 1.0f); + lineWidth(2.0f * map.getState().getPixelRatio()); + glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index()); + } glEnable(GL_DEPTH_TEST); } |