Use texture2DArray for colormap to work with OpenGL ES

This commit is contained in:
2025-03-05 21:14:43 +01:00
parent 5150ec5639
commit 7b70b6cce5
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -777,7 +777,7 @@ void ImageWidgetGL::initializeGL()
m_lut->bind(2); m_lut->bind(2);
QImage colormap = loadColormap(); QImage colormap = loadColormap();
m_colormap = std::make_unique<QOpenGLTexture>(QOpenGLTexture::Target1DArray); m_colormap = std::make_unique<QOpenGLTexture>(QOpenGLTexture::Target2DArray);
m_colormap->setSize(colormap.width()); m_colormap->setSize(colormap.width());
m_colormap->setLayers(colormap.height()); m_colormap->setLayers(colormap.height());
m_colormap->setFormat(QOpenGLTexture::RGBA8_UNorm); m_colormap->setFormat(QOpenGLTexture::RGBA8_UNorm);
+2 -2
View File
@@ -1,6 +1,6 @@
uniform sampler2D qt_Texture0; uniform sampler2D qt_Texture0;
uniform sampler3D lut_table; uniform sampler3D lut_table;
uniform sampler1DArray colormap; uniform sampler2DArray colormap;
uniform vec3 mtf_param[3]; uniform vec3 mtf_param[3];
uniform vec2 unit_scale; uniform vec2 unit_scale;
uniform bool bw; uniform bool bw;
@@ -30,7 +30,7 @@ vec3 falsecolor(float color)
{ {
color *= 255.0 / 256.0; color *= 255.0 / 256.0;
color += 0.5 / 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() vec3 checker()