From 7b70b6cce5cb717e792d693c6700e95731576c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Du=C5=A1an=20Poizl?= Date: Wed, 5 Mar 2025 21:14:43 +0100 Subject: [PATCH] Use texture2DArray for colormap to work with OpenGL ES --- imagewidget.cpp | 2 +- shaders/image.frag | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/imagewidget.cpp b/imagewidget.cpp index 3f5ca8a..7bd69a0 100644 --- a/imagewidget.cpp +++ b/imagewidget.cpp @@ -777,7 +777,7 @@ void ImageWidgetGL::initializeGL() m_lut->bind(2); QImage colormap = loadColormap(); - m_colormap = std::make_unique(QOpenGLTexture::Target1DArray); + m_colormap = std::make_unique(QOpenGLTexture::Target2DArray); m_colormap->setSize(colormap.width()); m_colormap->setLayers(colormap.height()); m_colormap->setFormat(QOpenGLTexture::RGBA8_UNorm); diff --git a/shaders/image.frag b/shaders/image.frag index e311e7e..3c7a801 100644 --- a/shaders/image.frag +++ b/shaders/image.frag @@ -1,6 +1,6 @@ uniform sampler2D qt_Texture0; uniform sampler3D lut_table; -uniform sampler1DArray colormap; +uniform sampler2DArray colormap; uniform vec3 mtf_param[3]; uniform vec2 unit_scale; uniform bool bw; @@ -30,7 +30,7 @@ vec3 falsecolor(float color) { color *= 255.0 / 256.0; color += 0.5 / 256.0; - return texture(colormap, vec2(color, colormapIdx)).rgb; + return texture(colormap, vec3(color, 0.5, colormapIdx)).rgb; } vec3 checker()