summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-11 18:04:01 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-05-12 03:00:10 +0200
commit5b7dfb07e3b167e8b6626f5d872abb8d3c8b5dd2 (patch)
treeef723c8040c1b9b3552b2d872156bc6f2993d3d2
parentca4c75ae7c0326c86e79532649a6a8c1bcbd5ce4 (diff)
move glm operator<< for debugging to OpenGLHelper
Change-Id: Ia529badffe08507d593f494230d2e504b68ff477
-rw-r--r--chart2/source/view/main/3DChartObjects.cxx21
-rw-r--r--chart2/source/view/main/GL3DRenderer.cxx21
-rw-r--r--include/vcl/opengl/OpenGLHelper.hxx6
-rw-r--r--vcl/source/opengl/OpenGLHelper.cxx22
4 files changed, 29 insertions, 41 deletions
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index 202eb972bf7d..aa5d3bc26a7c 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -11,31 +11,12 @@
#include <vcl/virdev.hxx>
#include <vcl/svapp.hxx>
-#include <ostream>
+#include <vcl/opengl/OpenGLHelper.hxx>
namespace chart {
namespace opengl3D {
-namespace {
-
-std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix)
-{
- for(int i = 0; i < 4; ++i)
- {
- rStrm << "( ";
- for(int j = 0; j < 4; ++j)
- {
- rStrm << rMatrix[j][i];
- rStrm << " ";
- }
- rStrm << ")\n";
- }
- return rStrm;
-}
-
-}
-
Renderable3DObject::Renderable3DObject(OpenGL3DRenderer* pRenderer, sal_uInt32 nId):
mpRenderer(pRenderer),
mnUniqueId(nId)
diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx
index 56a421e4d7bd..58e5e2091b81 100644
--- a/chart2/source/view/main/GL3DRenderer.cxx
+++ b/chart2/source/view/main/GL3DRenderer.cxx
@@ -1162,27 +1162,6 @@ glm::vec4 getColorAsVector(sal_uInt32 nColor)
return glm::vec4(nRed/255.0, nGreen/255.0, nBlue/255.0, (0xFF - nAlpha)/255.0);
}
-std::ostream& operator<<(std::ostream& rStrm, const glm::vec4& rPos)
-{
- rStrm << "( " << rPos[0] << ", " << rPos[1] << ", " << rPos[2] << ", " << rPos[3] << ")";
- return rStrm;
-}
-
-std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix)
-{
- for(int i = 0; i < 4; ++i)
- {
- rStrm << "\n( ";
- for(int j = 0; j < 4; ++j)
- {
- rStrm << rMatrix[j][i];
- rStrm << " ";
- }
- rStrm << ")\n";
- }
- return rStrm;
-}
-
}
void OpenGL3DRenderer::RenderNonRoundedBar(const glm::mat4& modelMatrix, sal_uInt32 nColor)
diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx
index 4afeae49228a..3cb482ba09b4 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -11,11 +11,14 @@
#define INCLUDED_VCL_OPENGL_OPENGLHELPER_HXX
#include <GL/glew.h>
+#include "glm/glm.hpp"
#include <vcl/vclopengl_dllapi.hxx>
#include <vcl/bitmapex.hxx>
#include <rtl/ustring.hxx>
+#include <ostream>
+
class VCLOPENGL_DLLPUBLIC OpenGLHelper
{
public:
@@ -28,6 +31,9 @@ public:
static const char* GLErrorString(GLenum errorCode);
};
+VCLOPENGL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix);
+VCLOPENGL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStrm, const glm::vec4& rPos);
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 4ef2ce0e62d7..0e9d7107988d 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -247,4 +247,26 @@ const char* OpenGLHelper::GLErrorString(GLenum errorCode)
return NULL;
}
+std::ostream& operator<<(std::ostream& rStrm, const glm::vec4& rPos)
+{
+ rStrm << "( " << rPos[0] << ", " << rPos[1] << ", " << rPos[2] << ", " << rPos[3] << ")";
+ return rStrm;
+}
+
+std::ostream& operator<<(std::ostream& rStrm, const glm::mat4& rMatrix)
+{
+ for(int i = 0; i < 4; ++i)
+ {
+ rStrm << "\n( ";
+ for(int j = 0; j < 4; ++j)
+ {
+ rStrm << rMatrix[j][i];
+ rStrm << " ";
+ }
+ rStrm << ")\n";
+ }
+ return rStrm;
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */