diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-10-15 12:52:02 +0300 |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2013-10-15 12:56:39 +0300 |
commit | 7861ae308bd9fd495f677400cc07c657a1439656 (patch) | |
tree | 994bab0cd5a31728ec653c2b3886ee15bed8ced0 /src/datavisualization/engine | |
parent | 0109b085710bfabc81faf43118ad5654cbd96081 (diff) |
Fix crashes and bugs when using surface with ES2
+Fix compile warnings
+Fix qmlsurface example
Change-Id: I28bbf38e7aa51b1ec315374182a9daae8eded87c
Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'src/datavisualization/engine')
4 files changed, 16 insertions, 13 deletions
diff --git a/src/datavisualization/engine/selectionpointer.cpp b/src/datavisualization/engine/selectionpointer.cpp index 6c3e0c8b..4fa9f688 100644 --- a/src/datavisualization/engine/selectionpointer.cpp +++ b/src/datavisualization/engine/selectionpointer.cpp @@ -245,12 +245,12 @@ void SelectionPointer::initShaders() // The shader for the small point ball if (m_pointShader) delete m_pointShader; -#if defined (Q_OS_ANDROID) - m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexES2"), - QStringLiteral(":/shaders/fragmentES2")); -#else +#if !defined(QT_OPENGL_ES_2) m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertex"), QStringLiteral(":/shaders/fragment")); +#else + m_pointShader = new ShaderHelper(this, QStringLiteral(":/shaders/vertexES2"), + QStringLiteral(":/shaders/fragmentES2")); #endif m_pointShader->initialize(); diff --git a/src/datavisualization/engine/surface3dcontroller.cpp b/src/datavisualization/engine/surface3dcontroller.cpp index 2272b731..c8823eb7 100644 --- a/src/datavisualization/engine/surface3dcontroller.cpp +++ b/src/datavisualization/engine/surface3dcontroller.cpp @@ -79,8 +79,11 @@ void Surface3DController::synchDataToRenderer() } if (m_changeTracker.smoothStatusChanged) { + bool oldSmoothStatus = m_isSmoothSurfaceEnabled; m_isSmoothSurfaceEnabled = m_renderer->updateSmoothStatus(m_isSmoothSurfaceEnabled); m_changeTracker.smoothStatusChanged = false; + if (oldSmoothStatus != m_isSmoothSurfaceEnabled) + emit smoothSurfaceEnabledChanged(m_isSmoothSurfaceEnabled); } if (m_changeTracker.surfaceGridChanged) { @@ -110,9 +113,13 @@ void Surface3DController::handleAxisRangeChangedBySender(QObject *sender) void Surface3DController::setSmoothSurface(bool enable) { + bool changed = m_isSmoothSurfaceEnabled != enable; m_isSmoothSurfaceEnabled = enable; m_changeTracker.smoothStatusChanged = true; emitNeedRender(); + + if (changed) + emit smoothSurfaceEnabledChanged(m_isSmoothSurfaceEnabled); } bool Surface3DController::smoothSurface() diff --git a/src/datavisualization/engine/surface3dcontroller_p.h b/src/datavisualization/engine/surface3dcontroller_p.h index 0efece97..0698c291 100644 --- a/src/datavisualization/engine/surface3dcontroller_p.h +++ b/src/datavisualization/engine/surface3dcontroller_p.h @@ -93,9 +93,7 @@ public slots: void handleArrayReset(); signals: - void smoothStatusChanged(bool enable); - void surfaceGridChanged(bool enable); - void segmentCountChanged(GLint segmentCount, GLfloat step, GLfloat minimum); + void smoothSurfaceEnabledChanged(bool enable); private: void adjustValueAxisRange(); diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp index 7aec3ff4..b73332f3 100644 --- a/src/datavisualization/engine/surface3drenderer.cpp +++ b/src/datavisualization/engine/surface3drenderer.cpp @@ -114,7 +114,6 @@ Surface3DRenderer::Surface3DRenderer(Surface3DController *controller) m_selectionModeChanged(false), m_hasHeightAdjustmentChanged(true) { -#if !defined(QT_OPENGL_ES_2) // Check if flat feature is supported ShaderHelper tester(this, QStringLiteral(":/shaders/vertexSurfaceFlat"), QStringLiteral(":/shaders/fragmentSurfaceFlat")); @@ -122,7 +121,6 @@ Surface3DRenderer::Surface3DRenderer(Surface3DController *controller) m_flatSupported = false; m_controller->setSmoothSurface(true); } -#endif m_cachedSmoothSurface = m_controller->smoothSurface(); updateSurfaceGridStatus(m_controller->surfaceGrid()); @@ -815,13 +813,13 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) QMatrix4x4 depthProjectionMatrix; QMatrix4x4 depthProjectionViewMatrix; - GLfloat adjustedLightStrength = m_cachedTheme.m_lightStrength / 10.0f; QVector3D surfaceScaler(m_surfaceScaleX, 1.0f, m_surfaceScaleZ); QVector3D surfaceOffset(m_surfaceOffsetX, 0.0f, m_surfaceOffsetZ + zComp); // Draw depth buffer #if !defined(QT_OPENGL_ES_2) + GLfloat adjustedLightStrength = m_cachedTheme.m_lightStrength / 10.0f; if (m_cachedShadowQuality > QDataVis::ShadowQualityNone && m_surfaceObj) { // Render scene into a depth texture for using with shadow mapping // Enable drawing to depth framebuffer @@ -966,10 +964,10 @@ void Surface3DRenderer::drawScene(GLuint defaultFboHandle) m_selectionShader->release(); // Put the RGBA value back to uint -#if defined (Q_OS_ANDROID) - selectionId = pixel[0] + pixel[1] * 256 + pixel[2] * 65536; -#else +#if !defined(QT_OPENGL_ES_2) selectionId = pixel[0] + pixel[1] * 256 + pixel[2] * 65536 + pixel[3] * 16777216; +#else + selectionId = pixel[0] + pixel[1] * 256 + pixel[2] * 65536; #endif selectionDirty = true; |