Debayer fix on OpenGL ES

This commit is contained in:
2024-08-25 14:39:07 +02:00
parent 1b08242433
commit 0239aba165
+7 -3
View File
@@ -225,6 +225,7 @@ void ImageWidget::allocateThumbnails(const QStringList &paths)
m_thumbnailTexture->setLayers(std::min((int)paths.size(), m_maxArrayLayers)); m_thumbnailTexture->setLayers(std::min((int)paths.size(), m_maxArrayLayers));
m_thumbnailTexture->setAutoMipMapGenerationEnabled(false); m_thumbnailTexture->setAutoMipMapGenerationEnabled(false);
m_thumbnailTexture->setWrapMode(QOpenGLTexture::ClampToEdge); m_thumbnailTexture->setWrapMode(QOpenGLTexture::ClampToEdge);
m_thumbnailTexture->setMipLevelRange(0, 0);
m_thumbnailTexture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear); m_thumbnailTexture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear);
m_thumbnailTexture->allocateStorage(); m_thumbnailTexture->allocateStorage();
} }
@@ -419,11 +420,14 @@ void ImageWidget::paintGL()
} }
else else
{ {
m_vao->bind();
debayer(); debayer();
m_vao->bind();
if(m_superpixel && m_debayerTex) if(m_superpixel && m_debayerTex)
{
f->glActiveTexture(GL_TEXTURE0);
f->glBindTexture(GL_TEXTURE_2D, m_debayerTex); f->glBindTexture(GL_TEXTURE_2D, m_debayerTex);
}
else else
m_image->bind(0); m_image->bind(0);
@@ -760,7 +764,7 @@ void ImageWidget::debayer()
{ {
if(m_debayerTex > 0 || !m_superpixel || !m_bwImg || m_imgWidth < 0)return; if(m_debayerTex > 0 || !m_superpixel || !m_bwImg || m_imgWidth < 0)return;
QOpenGLFramebufferObject fbo(m_imgWidth, m_imgHeight, QOpenGLFramebufferObject::NoAttachment, GL_TEXTURE_2D, GL_RGBA16); QOpenGLFramebufferObject fbo(m_imgWidth, m_imgHeight, QOpenGLFramebufferObject::NoAttachment, GL_TEXTURE_2D, GL_RGBA16F);
fbo.bind(); fbo.bind();
f->glViewport(0, 0, m_imgWidth, m_imgHeight); f->glViewport(0, 0, m_imgWidth, m_imgHeight);
@@ -774,9 +778,9 @@ void ImageWidget::debayer()
f->glViewport(0, 0, m_width, m_height); f->glViewport(0, 0, m_width, m_height);
m_debayerTex = fbo.takeTexture(); m_debayerTex = fbo.takeTexture();
f->glBindTexture(GL_TEXTURE_2D, m_debayerTex); f->glBindTexture(GL_TEXTURE_2D, m_debayerTex);
f->glGenerateMipmap(GL_TEXTURE_2D);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
f->glGenerateMipmap(GL_TEXTURE_2D);
} }
void ImageWidget::updateScrollBars() void ImageWidget::updateScrollBars()