Commit 535140c6 authored by Martin Schultz's avatar Martin Schultz

added changes from QOpenGL branch to enable and use GLDebugLogger when

OpenFlipper is started with the -d parameter
parent 118bb540
...@@ -133,6 +133,9 @@ glViewer::glViewer( QGraphicsScene* _scene, ...@@ -133,6 +133,9 @@ glViewer::glViewer( QGraphicsScene* _scene,
projectionUpdateLocked_(false), projectionUpdateLocked_(false),
glScene_(_scene), glScene_(_scene),
glWidget_(_glWidget), glWidget_(_glWidget),
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
glDebugLogger_(0),
#endif
pickCache_(0), pickCache_(0),
updatePickCache_(true), updatePickCache_(true),
pickCacheSupported_(true), pickCacheSupported_(true),
...@@ -210,6 +213,8 @@ glViewer::glViewer( QGraphicsScene* _scene, ...@@ -210,6 +213,8 @@ glViewer::glViewer( QGraphicsScene* _scene,
glViewer::~glViewer() glViewer::~glViewer()
{ {
delete glstate_; delete glstate_;
deleteGLDebugLogger();
} }
...@@ -1026,6 +1031,10 @@ void glViewer::initializeGL() ...@@ -1026,6 +1031,10 @@ void glViewer::initializeGL()
sceneGraph ( sceneGraphRoot_, maxPases,bbmin,bbmax,true); sceneGraph ( sceneGraphRoot_, maxPases,bbmin,bbmax,true);
viewAll(); viewAll();
} }
// qt opengl info
startGLDebugLogger();
} }
......
...@@ -118,6 +118,10 @@ class QOpenGLFramebufferObject; ...@@ -118,6 +118,10 @@ class QOpenGLFramebufferObject;
class QOpenGLFramebufferObjectFormat; class QOpenGLFramebufferObjectFormat;
#endif #endif
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
class QOpenGLDebugLogger;
class QOpenGLDebugMessage;
#endif
//== CLASS DEFINITION ========================================================= //== CLASS DEFINITION =========================================================
...@@ -533,6 +537,11 @@ protected slots: ...@@ -533,6 +537,11 @@ protected slots:
virtual void cleanupEventFilter() virtual void cleanupEventFilter()
{ removeEventFilter( sender());} { removeEventFilter( sender());}
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
/// process opengl debug messages
void processGLDebugMessage(const QOpenGLDebugMessage& msg);
#endif
//----------------------------------------------------------- private functions //----------------------------------------------------------- private functions
private: private:
...@@ -554,6 +563,9 @@ private: ...@@ -554,6 +563,9 @@ private:
/// draw the cursor /// draw the cursor
void drawCursor(); void drawCursor();
// start QOpenGLDebugLogger
void startGLDebugLogger();
void deleteGLDebugLogger();
//-------------------------------------------------------------- protected data //-------------------------------------------------------------- protected data
...@@ -608,6 +620,12 @@ private: ...@@ -608,6 +620,12 @@ private:
// Used to calculate the time passed between redraws // Used to calculate the time passed between redraws
QTime redrawTime_; QTime redrawTime_;
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
// Get additional debug info from OpenGL
QOpenGLDebugLogger* glDebugLogger_;
#endif
//=========================================================================== //===========================================================================
/** @name Wheels /** @name Wheels
* @{ */ * @{ */
......
...@@ -69,6 +69,9 @@ ...@@ -69,6 +69,9 @@
#include <QOpenGLContext> #include <QOpenGLContext>
#endif #endif
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
#include <QOpenGLDebugLogger>
#endif
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================
...@@ -89,7 +92,47 @@ void glViewer::swapBuffers() { ...@@ -89,7 +92,47 @@ void glViewer::swapBuffers() {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void glViewer::startGLDebugLogger()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
if (OpenFlipper::Options::debug())
{
delete glDebugLogger_;
glDebugLogger_ = new QOpenGLDebugLogger(this);
if (glDebugLogger_->initialize())
{
connect(glDebugLogger_, SIGNAL(messageLogged(QOpenGLDebugMessage)), this, SLOT(processGLDebugMessage(QOpenGLDebugMessage)));
glDebugLogger_->startLogging();
}
}
#endif
}
//-----------------------------------------------------------------------------
void glViewer::deleteGLDebugLogger()
{
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
makeCurrent();
delete glDebugLogger_;
#endif
}
//-----------------------------------------------------------------------------
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
void glViewer::processGLDebugMessage(const QOpenGLDebugMessage& msg)
{
if (msg.severity() & QOpenGLDebugMessage::HighSeverity)
std::cerr << msg.message().toStdString() << std::endl;
// also catch deprecated function calls in core profile
else if (!glstate_->compatibilityProfile() && msg.type() == QOpenGLDebugMessage::DeprecatedBehaviorType)
std::cerr << msg.message().toStdString() << std::endl;
}
#endif
//============================================================================= //=============================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment