summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Salmela <mika.salmela@digia.com>2013-12-20 12:03:59 +0200
committerMika Salmela <mika.salmela@digia.com>2013-12-20 12:05:37 +0200
commiteb3d0514ca886db33776522ea00f27b69bc86ad1 (patch)
tree3439287f6a70f681c5c9a08c77ec1b4342a24768
parent07aba602fc82ac31684988f8e8e22521d2b3c982 (diff)
parente895c5085f6097983bdd617c39ea5184541d6c4d (diff)
Merge branch 'develop'
-rw-r--r--README6
-rw-r--r--examples/audiolevels/audiolevelsiodevice.cpp4
-rw-r--r--examples/qmlbars/qml/qmlbars/main.qml1
-rw-r--r--examples/qmlcustominput/qml/qmlcustominput/main.qml3
-rw-r--r--examples/qmlscatter/doc/src/qmlscatter.qdoc7
-rw-r--r--examples/qmlscatter/qml/qmlscatter/main.qml1
-rw-r--r--examples/qmlsurface/qml/qmlsurface/main.qml1
-rw-r--r--examples/scatter/doc/src/scatter.qdoc2
-rw-r--r--examples/scatter/scatterdatamodifier.cpp1
-rw-r--r--examples/surface/surfacegraph.cpp1
-rw-r--r--src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp160
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc6
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc6
-rw-r--r--src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc6
-rw-r--r--src/datavisualization/engine/bars3drenderer.cpp12
-rw-r--r--src/datavisualization/engine/drawer.cpp3
-rw-r--r--src/datavisualization/engine/scatter3drenderer.cpp12
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp45
-rw-r--r--src/datavisualization/utils/abstractobjecthelper.cpp10
-rw-r--r--src/datavisualization/utils/surfaceobject.cpp3
20 files changed, 185 insertions, 105 deletions
diff --git a/README b/README
index 998c2f58..acd34527 100644
--- a/README
+++ b/README
@@ -73,6 +73,12 @@ Please refer to the generated documentation for more information:
Known Issues
============
+- All other QML elements are drawn on top of the Qt DataVisualization graphs,
+ including the parent elements of the graphs. To ensure the graphs are not
+ hidden, make sure you don't draw anything opaque on top of the graphs.
+ For example, Qt Creator application wizard for Qt Quick 2 applications
+ creates by default an opaque white Rectangle element as the main element,
+ which covers any graph added to it.
- Using multiple graphs in one application crashes on application shutdown
unless the last graph to have active context is deleted last.
- Android doesn't support both widgets and OpenGL simultaneously, so only
diff --git a/examples/audiolevels/audiolevelsiodevice.cpp b/examples/audiolevels/audiolevelsiodevice.cpp
index 970677c6..e4576638 100644
--- a/examples/audiolevels/audiolevelsiodevice.cpp
+++ b/examples/audiolevels/audiolevelsiodevice.cpp
@@ -66,7 +66,7 @@ qint64 AudioLevelsIODevice::writeData(const char *data, qint64 maxSize)
for (int i = 0; i <= middleRow; i++) {
QBarDataItem *srcPos = m_array->at(i)->data();
QBarDataItem *dstPos = srcPos + newDataSize;
- memmove(dstPos, srcPos, (rowSize - newDataSize) * sizeof(QBarDataItem));
+ memmove((void *)dstPos, (void *)srcPos, (rowSize - newDataSize) * sizeof(QBarDataItem));
}
}
@@ -90,7 +90,7 @@ qint64 AudioLevelsIODevice::writeData(const char *data, qint64 maxSize)
for (int i = rowCount - 1; i > middleRow; i--) {
QBarDataItem *srcPos = m_array->at(index++)->data();
QBarDataItem *dstPos = m_array->at(i)->data();
- memcpy(dstPos, srcPos, rowSize * sizeof(QBarDataItem));
+ memcpy((void *)dstPos, (void *)srcPos, rowSize * sizeof(QBarDataItem));
}
// Reset the proxy array now that data has been updated to trigger a redraw.
diff --git a/examples/qmlbars/qml/qmlbars/main.qml b/examples/qmlbars/qml/qmlbars/main.qml
index 1f8c1a3d..0581f834 100644
--- a/examples/qmlbars/qml/qmlbars/main.qml
+++ b/examples/qmlbars/qml/qmlbars/main.qml
@@ -27,7 +27,6 @@ Item {
id: mainview
width: 1280
height: 1024
- visible: true
property int buttonLayoutHeight: 180;
state: Screen.width < Screen.height ? "portrait" : "landscape"
diff --git a/examples/qmlcustominput/qml/qmlcustominput/main.qml b/examples/qmlcustominput/qml/qmlcustominput/main.qml
index f777fd6b..54ec3342 100644
--- a/examples/qmlcustominput/qml/qmlcustominput/main.qml
+++ b/examples/qmlcustominput/qml/qmlcustominput/main.qml
@@ -25,7 +25,6 @@ Item {
id: mainView
width: 1280
height: 720
- visible: true
Data {
id: graphData
@@ -182,7 +181,7 @@ Item {
id: cameraToggle
Layout.fillHeight: true
Layout.minimumWidth: parent.width / 3
- text: "Animate Camera"
+ text: "Pause Camera"
onClicked: {
cameraAnimationX.paused = !cameraAnimationX.paused;
diff --git a/examples/qmlscatter/doc/src/qmlscatter.qdoc b/examples/qmlscatter/doc/src/qmlscatter.qdoc
index b0f1fd1f..06719ffc 100644
--- a/examples/qmlscatter/doc/src/qmlscatter.qdoc
+++ b/examples/qmlscatter/doc/src/qmlscatter.qdoc
@@ -86,10 +86,15 @@
The last \c import just imports all the qml files in the same directory as our \c {main.qml},
because that's where \c newbutton.qml and \c data.qml are.
- Then we create our main \c Item, call it \c mainView and set it visible:
+ Then we create our main \c Item and call it \c mainView:
\snippet ../examples/qmlscatter/qml/qmlscatter/main.qml 1
+ \note The Qt Creator application wizard will set a \c Rectangle item as the main item, which
+ is opaque white by default. This doesn't work for us, because the graphs are rendered behind the other
+ QML elements. We change the main item type to \c Item, which is invisible. This way the graph is
+ not covered by the main item.
+
Then we'll add another \c Item inside it, and call it \c dataView. This will be the item to hold
the Scatter3D graph. We'll anchor it to the parent bottom:
diff --git a/examples/qmlscatter/qml/qmlscatter/main.qml b/examples/qmlscatter/qml/qmlscatter/main.qml
index 22eab76b..62727f84 100644
--- a/examples/qmlscatter/qml/qmlscatter/main.qml
+++ b/examples/qmlscatter/qml/qmlscatter/main.qml
@@ -26,7 +26,6 @@ import "."
//! [1]
Item {
id: mainView
- visible: true
//! [1]
//! [4]
diff --git a/examples/qmlsurface/qml/qmlsurface/main.qml b/examples/qmlsurface/qml/qmlsurface/main.qml
index 07a07891..9f37a3f5 100644
--- a/examples/qmlsurface/qml/qmlsurface/main.qml
+++ b/examples/qmlsurface/qml/qmlsurface/main.qml
@@ -25,7 +25,6 @@ Item {
id: mainview
width: 1280
height: 720
- visible: true
property int buttonMaximumWidth: surfaceGridToggle.width
property int buttonMinimumHeight: seriesToggle.height
diff --git a/examples/scatter/doc/src/scatter.qdoc b/examples/scatter/doc/src/scatter.qdoc
index 173ea6e3..9bef441c 100644
--- a/examples/scatter/doc/src/scatter.qdoc
+++ b/examples/scatter/doc/src/scatter.qdoc
@@ -80,7 +80,7 @@
\snippet ../examples/scatter/scatterdatamodifier.cpp 1
And finally we create a QScatterDataProxy and the associated QScatter3DSeries. We set custom label format
- for the series and add it to the graph:
+ and mesh smoothing for the series and add it to the graph:
\snippet ../examples/scatter/scatterdatamodifier.cpp 2
diff --git a/examples/scatter/scatterdatamodifier.cpp b/examples/scatter/scatterdatamodifier.cpp
index ade4eb59..6cdb1458 100644
--- a/examples/scatter/scatterdatamodifier.cpp
+++ b/examples/scatter/scatterdatamodifier.cpp
@@ -57,6 +57,7 @@ ScatterDataModifier::ScatterDataModifier(Q3DScatter *scatter)
QScatterDataProxy *proxy = new QScatterDataProxy;
QScatter3DSeries *series = new QScatter3DSeries(proxy);
series->setItemLabelFormat("@xTitle: @xLabel @yTitle: @yLabel @zTitle: @zLabel");
+ series->setMeshSmooth(m_smooth);
m_graph->addSeries(series);
//! [2]
diff --git a/examples/surface/surfacegraph.cpp b/examples/surface/surfacegraph.cpp
index 24ab3715..7ebb6b72 100644
--- a/examples/surface/surfacegraph.cpp
+++ b/examples/surface/surfacegraph.cpp
@@ -49,6 +49,7 @@ SurfaceGraph::SurfaceGraph(Q3DSurface *surface)
QImage heightMapImage(":/maps/mountain");
m_heightMapProxy = new QHeightMapSurfaceDataProxy(heightMapImage);
m_heightMapSeries = new QSurface3DSeries(m_heightMapProxy);
+ m_heightMapSeries->setItemLabelFormat(QStringLiteral("(@xLabel, @zLabel): @yLabel"));
m_heightMapProxy->setValueRanges(34.0f, 40.0f, 18.0f, 24.0f);
//! [2]
m_heightMapWidth = heightMapImage.width();
diff --git a/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp b/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp
index 03f6e847..623f7f6f 100644
--- a/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp
+++ b/src/datavisualization/doc/snippets/doc_src_qmldatavisualization.cpp
@@ -21,86 +21,124 @@ import QtDataVisualization 1.0
//! [0]
//! [1]
-Bars3D {
- rows: 4
- columns: 4
- barSpacing: Qt.size(0.5, 0.5)
- barSpacingRelative: false
-
- Bar3DSeries {
- itemLabelFormat: "@valueTitle for @colLabel, @rowLabel: @valueLabel"
-
- ItemModelBarDataProxy {
- itemModel: model // E.g. a list model defined elsewhere containing monthly expenses data.
- // Mapping model roles to bar series rows, columns, and values.
- rowRole: "year"
- columnRole: "city"
- valueRole: "expenses"
- rowCategories: ["2010", "2011", "2012", "2013"]
- columnCategories: ["Oulu", "Rauma", "Helsinki", "Tampere"]
+import QtQuick 2.0
+import QtDataVisualization 1.0
+
+Item {
+ width: 640
+ height: 480
+
+ Bars3D {
+ width: parent.width
+ height: parent.height
+
+ Bar3DSeries {
+ itemLabelFormat: "@colLabel, @rowLabel: @valueLabel"
+
+ ItemModelBarDataProxy {
+ itemModel: dataModel
+ // Mapping model roles to bar series rows, columns, and values.
+ rowRole: "year"
+ columnRole: "city"
+ valueRole: "expenses"
+ }
}
}
+
+ ListModel {
+ id: dataModel
+ ListElement{ year: "2012"; city: "Oulu"; expenses: "4200"; }
+ ListElement{ year: "2012"; city: "Rauma"; expenses: "2100"; }
+ ListElement{ year: "2012"; city: "Helsinki"; expenses: "7040"; }
+ ListElement{ year: "2012"; city: "Tampere"; expenses: "4330"; }
+ ListElement{ year: "2013"; city: "Oulu"; expenses: "3960"; }
+ ListElement{ year: "2013"; city: "Rauma"; expenses: "1990"; }
+ ListElement{ year: "2013"; city: "Helsinki"; expenses: "7230"; }
+ ListElement{ year: "2013"; city: "Tampere"; expenses: "4650"; }
+ }
}
//! [1]
//! [2]
-Scatter3D {
- axisX.segmentCount: 2
- axisX.subSegmentCount: 2
- axisX.labelFormat: "%.2f"
- axisZ.segmentCount: 2
- axisZ.subSegmentCount: 2
- axisZ.labelFormat: "%.2f"
- axisY.segmentCount: 3
- axisY.subSegmentCount: 2
- axisY.labelFormat: "%.2f"
-
- Scatter3DSeries {
- itemLabelFormat: "X:@xLabel Y:@yLabel Z:@zLabel"
-
- ItemModelScatterDataProxy {
- itemModel: model // E.g. a list model defined elsewhere containing point coordinates.
- // Mapping model roles to scatter series item coordinates.
- xPosRole: "xPos"
- yPosRole: "yPos"
- zPosRole: "zPos"
+import QtQuick 2.0
+import QtDataVisualization 1.0
+
+Item {
+ width: 640
+ height: 480
+
+ Scatter3D {
+ width: parent.width
+ height: parent.height
+ Scatter3DSeries {
+ ItemModelScatterDataProxy {
+ itemModel: dataModel
+ // Mapping model roles to scatter series item coordinates.
+ xPosRole: "xPos"
+ yPosRole: "yPos"
+ zPosRole: "zPos"
+ }
}
}
+
+ ListModel {
+ id: dataModel
+ ListElement{ xPos: "2.754"; yPos: "1.455"; zPos: "3.362"; }
+ ListElement{ xPos: "3.164"; yPos: "2.022"; zPos: "4.348"; }
+ ListElement{ xPos: "4.564"; yPos: "1.865"; zPos: "1.346"; }
+ ListElement{ xPos: "1.068"; yPos: "1.224"; zPos: "2.983"; }
+ ListElement{ xPos: "2.323"; yPos: "2.502"; zPos: "3.133"; }
+ }
}
//! [2]
//! [3]
-Surface3D {
- axisX.min: 0.0
- axisX.max: 10.0
- axisZ.min: 0.0
- axisZ.max: 10.0
- axisY.min: 0.0
- axisY.max: 5.0
- axisX.segmentCount: 5
- axisX.subSegmentCount: 2
- axisX.labelFormat: "%i"
- axisZ.segmentCount: 5
- axisZ.subSegmentCount: 2
- axisZ.labelFormat: "%i"
- axisY.segmentCount: 5
- axisY.labelFormat: "%.1f"
-
- Surface3DSeries {
- ItemModelSurfaceDataProxy {
- itemModel: model // E.g. a list model defined elsewhere containing population data.
- // Mapping model roles to surface series rows, columns, and values.
- rowRole: "longitude"
- columnRole: "latitude"
- valueRole: "pop_density"
+import QtQuick 2.0
+import QtDataVisualization 1.0
+
+Item {
+ width: 640
+ height: 480
+
+ Surface3D {
+ width: parent.width
+ height: parent.height
+ Surface3DSeries {
+ itemLabelFormat: "Pop density at (@xLabel N, @zLabel E): @yLabel"
+ ItemModelSurfaceDataProxy {
+ itemModel: dataModel
+ // Mapping model roles to surface series rows, columns, and values.
+ rowRole: "longitude"
+ columnRole: "latitude"
+ valueRole: "pop_density"
+ }
}
}
+ ListModel {
+ id: dataModel
+ ListElement{ longitude: "20"; latitude: "10"; pop_density: "4.75"; }
+ ListElement{ longitude: "21"; latitude: "10"; pop_density: "3.00"; }
+ ListElement{ longitude: "22"; latitude: "10"; pop_density: "1.24"; }
+ ListElement{ longitude: "23"; latitude: "10"; pop_density: "2.53"; }
+ ListElement{ longitude: "20"; latitude: "11"; pop_density: "2.55"; }
+ ListElement{ longitude: "21"; latitude: "11"; pop_density: "2.03"; }
+ ListElement{ longitude: "22"; latitude: "11"; pop_density: "3.46"; }
+ ListElement{ longitude: "23"; latitude: "11"; pop_density: "5.12"; }
+ ListElement{ longitude: "20"; latitude: "12"; pop_density: "1.37"; }
+ ListElement{ longitude: "21"; latitude: "12"; pop_density: "2.98"; }
+ ListElement{ longitude: "22"; latitude: "12"; pop_density: "3.33"; }
+ ListElement{ longitude: "23"; latitude: "12"; pop_density: "3.23"; }
+ ListElement{ longitude: "20"; latitude: "13"; pop_density: "4.34"; }
+ ListElement{ longitude: "21"; latitude: "13"; pop_density: "3.54"; }
+ ListElement{ longitude: "22"; latitude: "13"; pop_density: "1.65"; }
+ ListElement{ longitude: "23"; latitude: "13"; pop_density: "2.67"; }
+ }
}
//! [3]
//! [7]
ItemModelBarDataProxy {
- itemModel: model // E.g. a list model defined elsewhere containing monthly expenses data.
+ itemModel: model // E.g. a list model defined elsewhere containing yearly expenses data.
// Mapping model roles to bar series rows, columns, and values.
rowRole: "year"
columnRole: "city"
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
index fc1b732c..edeb5530 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-bars3d.qdoc
@@ -36,6 +36,11 @@
*
* See \l{Qt Quick 2 Bars Example} for more thorough usage example.
*
+ * \note Qt Data Visualization graphs are rendered behind any other QML elements on screen, including
+ * the parent elements of the graph. To make the whole graph show, ensure that no other element
+ * draws anything over the area the graph occupies. For example, having a non-transparent \c Rectangle
+ * item as the parent of a graph causes the graph to be hidden.
+ *
* \sa Bar3DSeries, ItemModelBarDataProxy, Scatter3D, Surface3D, {Qt Data Visualization C++ Classes}
*/
@@ -83,6 +88,7 @@
/*!
* \qmlproperty list<QBar3DSeries> Bars3D::seriesList
+ * \default
* This property holds the series of the graph.
* By default, this property contains an empty list.
* To set the series, either use the addSeries() function or define them as children of the graph.
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
index 1f04424f..0a8e1674 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-scatter3d.qdoc
@@ -36,6 +36,11 @@
See \l{Qt Quick 2 Scatter Example} for more thorough usage example.
+ \note Qt Data Visualization graphs are rendered behind any other QML elements on screen, including
+ the parent elements of the graph. To make the whole graph show, ensure that no other element
+ draws anything over the area the graph occupies. For example, having a non-transparent \c Rectangle
+ item as the parent of a graph causes the graph to be hidden.
+
\sa Scatter3DSeries, ScatterDataProxy, Bars3D, Surface3D, {Qt Data Visualization C++ Classes}
*/
@@ -68,6 +73,7 @@
/*!
* \qmlproperty list<QScatter3DSeries> Scatter3D::seriesList
+ * \default
* This property holds the series of the graph.
* By default, this property contains an empty list.
* To set the series, either use the addSeries() function or define them as children of the graph.
diff --git a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
index a3886008..b28d30a7 100644
--- a/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
+++ b/src/datavisualization/doc/src/qtdatavisualization-qml-surface3d.qdoc
@@ -36,6 +36,11 @@
See \l{Qt Quick 2 Surface Example} for more thorough usage example.
+ \note Qt Data Visualization graphs are rendered behind any other QML elements on screen, including
+ the parent elements of the graph. To make the whole graph show, ensure that no other element
+ draws anything over the area the graph occupies. For example, having a non-transparent \c Rectangle
+ item as the parent of a graph causes the graph to be hidden.
+
\sa Surface3DSeries, ItemModelSurfaceDataProxy, Bars3D, Scatter3D, {Qt Data Visualization C++ Classes}
*/
@@ -74,6 +79,7 @@
/*!
* \qmlproperty list<QSurface3DSeries> Surface3D::seriesList
+ * \default
* This property holds the series of the graph.
* By default, this property contains an empty list.
* To set the series, either use the addSeries() function or define them as children of the graph.
diff --git a/src/datavisualization/engine/bars3drenderer.cpp b/src/datavisualization/engine/bars3drenderer.cpp
index ecdac21f..f13b6e79 100644
--- a/src/datavisualization/engine/bars3drenderer.cpp
+++ b/src/datavisualization/engine/bars3drenderer.cpp
@@ -99,11 +99,13 @@ Bars3DRenderer::Bars3DRenderer(Bars3DController *controller)
Bars3DRenderer::~Bars3DRenderer()
{
- m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer);
- m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer);
- m_textureHelper->deleteTexture(&m_selectionTexture);
- m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer);
- m_textureHelper->deleteTexture(&m_bgrTexture);
+ if (QOpenGLContext::currentContext()) {
+ m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer);
+ m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer);
+ m_textureHelper->deleteTexture(&m_selectionTexture);
+ m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer);
+ m_textureHelper->deleteTexture(&m_bgrTexture);
+ }
delete m_barShader;
delete m_barGradientShader;
diff --git a/src/datavisualization/engine/drawer.cpp b/src/datavisualization/engine/drawer.cpp
index 14f0b315..f78b2d29 100644
--- a/src/datavisualization/engine/drawer.cpp
+++ b/src/datavisualization/engine/drawer.cpp
@@ -56,7 +56,8 @@ Drawer::Drawer(Q3DTheme *theme)
Drawer::~Drawer()
{
delete m_textureHelper;
- glDeleteBuffers(1, &m_pointbuffer);
+ if (QOpenGLContext::currentContext())
+ glDeleteBuffers(1, &m_pointbuffer);
}
void Drawer::initializeOpenGL()
diff --git a/src/datavisualization/engine/scatter3drenderer.cpp b/src/datavisualization/engine/scatter3drenderer.cpp
index 00452cf7..ee5c119e 100644
--- a/src/datavisualization/engine/scatter3drenderer.cpp
+++ b/src/datavisualization/engine/scatter3drenderer.cpp
@@ -98,11 +98,13 @@ Scatter3DRenderer::Scatter3DRenderer(Scatter3DController *controller)
Scatter3DRenderer::~Scatter3DRenderer()
{
- m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer);
- m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer);
- m_textureHelper->deleteTexture(&m_selectionTexture);
- m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer);
- m_textureHelper->deleteTexture(&m_bgrTexture);
+ if (QOpenGLContext::currentContext()) {
+ m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer);
+ m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer);
+ m_textureHelper->deleteTexture(&m_selectionTexture);
+ m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer);
+ m_textureHelper->deleteTexture(&m_bgrTexture);
+ }
delete m_dotShader;
delete m_dotGradientShader;
delete m_depthShader;
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index 7049632d..912edd97 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -134,16 +134,17 @@ Surface3DRenderer::Surface3DRenderer(Surface3DController *controller)
Surface3DRenderer::~Surface3DRenderer()
{
- m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer);
- m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer);
- m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer);
-
- m_textureHelper->deleteTexture(&m_depthTexture);
- m_textureHelper->deleteTexture(&m_depthModelTexture);
- m_textureHelper->deleteTexture(&m_selectionTexture);
- m_textureHelper->deleteTexture(&m_selectionResultTexture);
- m_textureHelper->deleteTexture(&m_uniformGradientTexture);
+ if (QOpenGLContext::currentContext()) {
+ m_textureHelper->glDeleteFramebuffers(1, &m_depthFrameBuffer);
+ m_textureHelper->glDeleteRenderbuffers(1, &m_selectionDepthBuffer);
+ m_textureHelper->glDeleteFramebuffers(1, &m_selectionFrameBuffer);
+ m_textureHelper->deleteTexture(&m_depthTexture);
+ m_textureHelper->deleteTexture(&m_depthModelTexture);
+ m_textureHelper->deleteTexture(&m_selectionTexture);
+ m_textureHelper->deleteTexture(&m_selectionResultTexture);
+ m_textureHelper->deleteTexture(&m_uniformGradientTexture);
+ }
delete m_shader;
delete m_depthShader;
delete m_backgroundShader;
@@ -264,6 +265,10 @@ void Surface3DRenderer::updateData()
delete m_surfaceObj;
m_surfaceObj = 0;
+#if !defined(QT_OPENGL_ES_2)
+ m_textureHelper->fillDepthTexture(m_depthTexture, m_primarySubViewport.size(),
+ m_shadowQualityMultiplier, 1.0f);
+#endif
}
for (int i = 0; i < m_sliceDataArray.size(); i++)
@@ -285,6 +290,12 @@ void Surface3DRenderer::updateSeries(const QList<QAbstract3DSeries *> &seriesLis
QSurface3DSeries::DrawFlags drawMode = series->drawMode();
m_cachedSurfaceVisible = drawMode.testFlag(QSurface3DSeries::DrawSurface);
+#if !defined(QT_OPENGL_ES_2)
+ if (!m_cachedSurfaceVisible) {
+ m_textureHelper->fillDepthTexture(m_depthTexture, m_primarySubViewport.size(),
+ m_shadowQualityMultiplier, 1.0f);
+ }
+#endif
m_cachedSurfaceGridOn = drawMode.testFlag(QSurface3DSeries::DrawWireframe);
QVector3D seriesColor = Utils::vectorFromColor(series->baseColor());
@@ -304,11 +315,9 @@ void Surface3DRenderer::updateRows(const QVector<int> &rows)
const QSurfaceDataArray *array = 0;
if (m_visibleSeriesList.size()) {
QSurface3DSeries *firstSeries = static_cast<QSurface3DSeries *>(m_visibleSeriesList.at(0).series());
- if (m_cachedSurfaceGridOn || m_cachedSurfaceVisible) {
- QSurfaceDataProxy *dataProxy = firstSeries->dataProxy();
- if (dataProxy)
- array = dataProxy->array();
- }
+ QSurfaceDataProxy *dataProxy = firstSeries->dataProxy();
+ if (dataProxy)
+ array = dataProxy->array();
}
if (array && array->size() >= 2 && array->at(0)->size() >= 2 &&
@@ -346,11 +355,9 @@ void Surface3DRenderer::updateItem(const QVector<QPoint> &points)
const QSurfaceDataArray *array = 0;
if (m_visibleSeriesList.size()) {
QSurface3DSeries *firstSeries = static_cast<QSurface3DSeries *>(m_visibleSeriesList.at(0).series());
- if (m_cachedSurfaceGridOn || m_cachedSurfaceVisible) {
- QSurfaceDataProxy *dataProxy = firstSeries->dataProxy();
- if (dataProxy)
- array = dataProxy->array();
- }
+ QSurfaceDataProxy *dataProxy = firstSeries->dataProxy();
+ if (dataProxy)
+ array = dataProxy->array();
}
if (array && array->size() >= 2 && array->at(0)->size() >= 2 &&
diff --git a/src/datavisualization/utils/abstractobjecthelper.cpp b/src/datavisualization/utils/abstractobjecthelper.cpp
index d47f2fe6..96cdc0c4 100644
--- a/src/datavisualization/utils/abstractobjecthelper.cpp
+++ b/src/datavisualization/utils/abstractobjecthelper.cpp
@@ -34,10 +34,12 @@ AbstractObjectHelper::AbstractObjectHelper()
AbstractObjectHelper::~AbstractObjectHelper()
{
- glDeleteBuffers(1, &m_vertexbuffer);
- glDeleteBuffers(1, &m_uvbuffer);
- glDeleteBuffers(1, &m_normalbuffer);
- glDeleteBuffers(1, &m_elementbuffer);
+ if (QOpenGLContext::currentContext()) {
+ glDeleteBuffers(1, &m_vertexbuffer);
+ glDeleteBuffers(1, &m_uvbuffer);
+ glDeleteBuffers(1, &m_normalbuffer);
+ glDeleteBuffers(1, &m_elementbuffer);
+ }
}
GLuint AbstractObjectHelper::vertexBuf()
diff --git a/src/datavisualization/utils/surfaceobject.cpp b/src/datavisualization/utils/surfaceobject.cpp
index 605376e2..6e4765e5 100644
--- a/src/datavisualization/utils/surfaceobject.cpp
+++ b/src/datavisualization/utils/surfaceobject.cpp
@@ -39,7 +39,8 @@ SurfaceObject::SurfaceObject()
SurfaceObject::~SurfaceObject()
{
- glDeleteBuffers(1, &m_gridElementbuffer);
+ if (QOpenGLContext::currentContext())
+ glDeleteBuffers(1, &m_gridElementbuffer);
}
void SurfaceObject::setUpSmoothData(const QSurfaceDataArray &dataArray, const QRect &space,