--- a/src/gl/partrenderer.cpp Mon Jun 20 18:40:22 2022 +0300 +++ b/src/gl/partrenderer.cpp Mon Jun 20 19:49:56 2022 +0300 @@ -27,6 +27,8 @@ #include "partrenderer.h" #include "model.h" #include "gl/compiler.h" +#include "gl/debug.h" +#include "settings.h" static constexpr double MIN_ZOOM = -3.0; static constexpr double MAX_ZOOM = 3.0; @@ -47,6 +49,9 @@ QSurfaceFormat surfaceFormat; surfaceFormat.setSamples(8); this->setFormat(surfaceFormat); + connect(&this->logger, &QOpenGLDebugLogger::messageLogged, [&](const QOpenGLDebugMessage& glmessage){ + Q_EMIT this->message(debugMessageToString(glmessage)); + }); connect(model, &Model::rowsInserted, [&]{ this->needBuild = true; }); @@ -92,6 +97,10 @@ for (RenderLayer* layer : this->inactiveRenderLayers) { layer->initializeGL(); } + this->logger.initialize(); + if (setting<Setting::LogOpenGLDebugMessages>()) { + this->logger.startLogging(); + } connect(this->model, &Model::dataChanged, this, &PartRenderer::build); this->initialized = true; this->modelQuaternion = glm::angleAxis(glm::radians(30.0f), glm::vec3{-1, 0, 0}); @@ -484,6 +493,15 @@ { this->build(); } + if (this->initialized) { + this->makeCurrent(); + if (setting<Setting::LogOpenGLDebugMessages>()) { + this->logger.startLogging(); + } + else { + this->logger.stopLogging(); + } + } Q_EMIT this->renderPreferencesChanged(); this->update(); }