From abcf5920eb82b2d262315b4ca562f5b55d5e1065 Mon Sep 17 00:00:00 2001
From: Federico Montesino Pouzols <federico.montesino-pouzols@stfc.ac.uk>
Date: Wed, 14 Oct 2015 08:28:16 +0100
Subject: [PATCH] get GL errors and log to debug, 1076045, re #13951

---
 MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp       | 5 +++++
 MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h         | 2 ++
 MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp | 3 ++-
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp
index 8da241a02ea..afa7126f749 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.cpp
@@ -33,3 +33,8 @@ std::ostream& OpenGLError::log()
 {
   return g_log.error();
 }
+
+std::ostream& OpenGLError::logDebug()
+{
+  return g_log.debug();
+}
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h
index cdeb10d98f2..c5e63188a82 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h
+++ b/MantidPlot/src/Mantid/InstrumentWidget/OpenGLError.h
@@ -16,6 +16,8 @@ public:
   static bool check(const std::string& funName);
   static bool hasError(const std::string& funName){return check(funName);}
   static std::ostream& log();
+  static std::ostream& logDebug();
+
 private:
   std::string m_msg;
 };
diff --git a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp
index 1c6a0052da5..37a85ee1cfd 100644
--- a/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp
+++ b/MantidPlot/src/Mantid/InstrumentWidget/ProjectionSurface.cpp
@@ -220,7 +220,8 @@ void ProjectionSurface::draw(MantidGLWidget *widget,bool picking)const
     getController()->onPaint( painter );
     painter.end();
     // Discard any error generated here
-    glGetError();
+    GLuint ecode = glGetError();
+    OpenGLError::logDebug() << "Discarding OpenGL error: " << gluErrorString(ecode);
   }
 
 }
-- 
GitLab