summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-04-08 01:17:16 +0200
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-04-08 04:38:22 +0200
commit0869626e2b29ad9b2e81c8f4eee7bd1b2372d91b (patch)
treebf80e1e7a0ec761d834aa22a412c4c4593ba507b /chart2
parented649cc4817b6d35e71d15331293afd91fba9358 (diff)
improve the code for temporary OpenGl context
Change-Id: Ia66bf54539e67066a56bb50fb606e50e581bee73
Diffstat (limited to 'chart2')
-rw-r--r--chart2/Library_chartcore.mk2
-rw-r--r--chart2/source/view/charttypes/3DBarChart.cxx10
-rw-r--r--chart2/source/view/inc/3DBarChart.hxx8
-rw-r--r--chart2/source/view/inc/3DChartObjects.hxx17
-rw-r--r--chart2/source/view/main/3DChartObjects.cxx14
5 files changed, 45 insertions, 6 deletions
diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk
index 55aa61038f9b..e4b0051cfd6a 100644
--- a/chart2/Library_chartcore.mk
+++ b/chart2/Library_chartcore.mk
@@ -29,6 +29,7 @@ $(eval $(call gb_Library_use_externals,chartcore,\
boost_headers \
mdds_headers \
glm_headers \
+ glew \
))
$(eval $(call gb_Library_use_custom_headers,chartcore,\
@@ -56,6 +57,7 @@ $(eval $(call gb_Library_use_libraries,chartcore,\
ucbhelper \
utl \
vcl \
+ vclopengl \
$(gb_UWINAPI) \
))
diff --git a/chart2/source/view/charttypes/3DBarChart.cxx b/chart2/source/view/charttypes/3DBarChart.cxx
index 79c02a605184..3a13059be014 100644
--- a/chart2/source/view/charttypes/3DBarChart.cxx
+++ b/chart2/source/view/charttypes/3DBarChart.cxx
@@ -9,15 +9,16 @@
#include "3DBarChart.hxx"
-#include "3DChartObjects.hxx"
-
#include <glm/glm.hpp>
#include <glm/gtx/transform.hpp>
+#include "3DChartObjects.hxx"
+
namespace chart {
Bar3DChart::Bar3DChart(const std::vector<VDataSeries*>& rDataSeries):
- maDataSeries(rDataSeries)
+ maDataSeries(rDataSeries),
+ mxContext(new opengl3D::temporary::TemporaryContext())
{
}
@@ -57,12 +58,13 @@ void Bar3DChart::create3DShapes()
void Bar3DChart::render()
{
- maContext.init();
+ mxContext->init();
for(boost::ptr_vector<opengl3D::Renderable3DObject>::iterator itr = maShapes.begin(),
itrEnd = maShapes.end(); itr != itrEnd; ++itr)
{
itr->render();
}
+ mxContext->render();
}
}
diff --git a/chart2/source/view/inc/3DBarChart.hxx b/chart2/source/view/inc/3DBarChart.hxx
index 0cc5831b7016..2f10ce26d41f 100644
--- a/chart2/source/view/inc/3DBarChart.hxx
+++ b/chart2/source/view/inc/3DBarChart.hxx
@@ -19,7 +19,11 @@ namespace opengl3D {
class Renderable3DObject;
-}
+namespace temporary {
+
+class TemporaryContext;
+
+} }
class Bar3DChart
{
@@ -36,7 +40,7 @@ private:
std::vector<VDataSeries*> maDataSeries;
boost::ptr_vector<opengl3D::Renderable3DObject> maShapes;
- OpenGLContext maContext;
+ boost::scoped_ptr<opengl3D::temporary::TemporaryContext> mxContext;
};
}
diff --git a/chart2/source/view/inc/3DChartObjects.hxx b/chart2/source/view/inc/3DChartObjects.hxx
index ec56ad82b0cf..f7eed23e8733 100644
--- a/chart2/source/view/inc/3DChartObjects.hxx
+++ b/chart2/source/view/inc/3DChartObjects.hxx
@@ -12,6 +12,8 @@
#include <tools/color.hxx>
#include <vcl/bitmapex.hxx>
+#include <vcl/OpenGLContext.hxx>
+
namespace chart {
namespace opengl3D {
@@ -64,6 +66,21 @@ private:
Color maLineColor; // RGBA line color
};
+namespace temporary {
+
+class TemporaryContext
+{
+public:
+
+ void init();
+ void render();
+
+private:
+ OpenGLContext maContext;
+};
+
+}
+
}
}
diff --git a/chart2/source/view/main/3DChartObjects.cxx b/chart2/source/view/main/3DChartObjects.cxx
index 0a0696ab801b..3c5a5b8b6138 100644
--- a/chart2/source/view/main/3DChartObjects.cxx
+++ b/chart2/source/view/main/3DChartObjects.cxx
@@ -18,6 +18,20 @@ Bar::Bar(const glm::mat4& rPosition):
{
}
+namespace temporary {
+
+void TemporaryContext::init()
+{
+ maContext.init();
+}
+
+void TemporaryContext::render()
+{
+
+}
+
+}
+
}
}