diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-08 23:41:39 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-08 23:41:39 +0200 |
| commit | 07d8adea58ec5b6b51704be1caf84012b0049313 (patch) | |
| tree | d7f7571c766d0241b2e598a284ff5d396d9f66dc /main/debug.cpp | |
| parent | dcac3d7bd83c0cbdddae433e98598289bb1b06cd (diff) | |
a
Diffstat (limited to 'main/debug.cpp')
| -rw-r--r-- | main/debug.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
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 <Magnum/GL/Renderer.h> + +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<const app*>(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 |
