From 07d8adea58ec5b6b51704be1caf84012b0049313 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 8 Oct 2022 23:41:39 +0200 Subject: a --- main/debug.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 main/debug.cpp (limited to 'main/debug.cpp') diff --git a/main/debug.cpp b/main/debug.cpp new file mode 100644 index 00000000..7e7e3abf --- /dev/null +++ b/main/debug.cpp @@ -0,0 +1,35 @@ +#include "app.hpp" +#include + +namespace Magnum::Examples { + +using Feature = GL::Renderer::Feature; +using Severity = GL::DebugOutput::Severity; +using Type = GL::DebugOutput::Type; +using GL::Renderer; +using GL::DebugOutput; + +void app::debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id, + GL::DebugOutput::Severity severity, const std::string& str) const +{ + std::fputs(str.c_str(), stdout); + std::fputc('\n', stdout); + std::fflush(stdout); + std::puts(""); // put breakpoint here +} + +static void _debug_callback(GL::DebugOutput::Source src, GL::DebugOutput::Type type, UnsignedInt id, + GL::DebugOutput::Severity severity, const std::string& str, const void* self) +{ + static_cast(self)->debug_callback(src, type, id, severity, str); +} + +void app::register_debug_callback() +{ + GL::Renderer::setFeature(Feature::DebugOutput, true); + GL::Renderer::setFeature(Feature::DebugOutputSynchronous, true); + GL::DebugOutput::setCallback(_debug_callback, this); + GL::DebugOutput::setEnabled(Severity::High, true); +} + +} // namespace Magnum::Examples -- cgit v1.2.3