summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Salmela <mika.salmela@qt.io>2017-09-05 09:55:07 +0300
committerMika Salmela <mika.salmela@qt.io>2017-09-05 07:00:50 +0000
commitfdc983fb3c4ad79cdba282d84a7d8c51ae740965 (patch)
tree11e501c8053341697347b85147974298482cb852
parent3f8ae713dfdbaeb34bdc52d905fe5ca16765cf7f (diff)
Set clamp to edge wrap modes for surface textures
By default surface textures had wrong wrap modes making the color bleed on edges. This patch changes the texture wrap modes to clamp to edge. Task-number: QTBUG-62996 Change-Id: Iebee66b01a78db6036cb0c833f39237f8e98b6b7 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/datavisualization/engine/surface3drenderer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/datavisualization/engine/surface3drenderer.cpp b/src/datavisualization/engine/surface3drenderer.cpp
index 9cfa0edc..9fa1eeb8 100644
--- a/src/datavisualization/engine/surface3drenderer.cpp
+++ b/src/datavisualization/engine/surface3drenderer.cpp
@@ -317,8 +317,12 @@ void Surface3DRenderer::updateSurfaceTextures(QVector<QSurface3DSeries *> series
const QSurfaceDataArray &array = *dataProxy->array();
if (!series->texture().isNull()) {
- cache->setSurfaceTexture(m_textureHelper->create2DTexture(
- series->texture(), true, true, true));
+ GLuint texId = m_textureHelper->create2DTexture(series->texture(),
+ true, true, true, true);
+ glBindTexture(GL_TEXTURE_2D, texId);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ cache->setSurfaceTexture(texId);
if (cache->isFlatShadingEnabled())
cache->surfaceObject()->coarseUVs(array, cache->dataArray());