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,
projectionUpdateLocked_(false),
glScene_(_scene),
glWidget_(_glWidget),
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
glDebugLogger_(0),
#endif
pickCache_(0),
updatePickCache_(true),
pickCacheSupported_(true),
......@@ -210,6 +213,8 @@ glViewer::glViewer( QGraphicsScene* _scene,
glViewer::~glViewer()
{
delete glstate_;
deleteGLDebugLogger();
}
......@@ -1026,6 +1031,10 @@ void glViewer::initializeGL()
sceneGraph ( sceneGraphRoot_, maxPases,bbmin,bbmax,true);
viewAll();
}
// qt opengl info
startGLDebugLogger();
}
......
......@@ -118,6 +118,10 @@ class QOpenGLFramebufferObject;
class QOpenGLFramebufferObjectFormat;
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
class QOpenGLDebugLogger;
class QOpenGLDebugMessage;
#endif
//== CLASS DEFINITION =========================================================
......@@ -533,6 +537,11 @@ protected slots:
virtual void cleanupEventFilter()
{ removeEventFilter( sender());}
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
/// process opengl debug messages
void processGLDebugMessage(const QOpenGLDebugMessage& msg);
#endif
//----------------------------------------------------------- private functions
private:
......@@ -554,6 +563,9 @@ private:
/// draw the cursor
void drawCursor();
// start QOpenGLDebugLogger
void startGLDebugLogger();
void deleteGLDebugLogger();
//-------------------------------------------------------------- protected data
......@@ -608,6 +620,12 @@ private:
// Used to calculate the time passed between redraws
QTime redrawTime_;
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
// Get additional debug info from OpenGL
QOpenGLDebugLogger* glDebugLogger_;
#endif
//===========================================================================
/** @name Wheels
* @{ */
......
......@@ -69,6 +69,9 @@
#include <QOpenGLContext>
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5,1,0))
#include <QOpenGLDebugLogger>
#endif
//== NAMESPACES ===============================================================
......@@ -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