Make it combilable with Qt 5.13 and older
This commit is contained in:
+12
-1
@@ -24,8 +24,13 @@ const RawImageType rawImageTypes[] = {
|
||||
{QOpenGLTexture::Red, QOpenGLTexture::R8_UNorm, QOpenGLTexture::UInt8, true},
|
||||
{QOpenGLTexture::Red, QOpenGLTexture::R16_UNorm, QOpenGLTexture::UInt16, true},
|
||||
{QOpenGLTexture::Red, QOpenGLTexture::R32F, QOpenGLTexture::Float32, true},
|
||||
#ifdef COLOR_MANAGMENT
|
||||
{QOpenGLTexture::RGB, QOpenGLTexture::SRGB8, QOpenGLTexture::UInt8, false},
|
||||
{QOpenGLTexture::RGBA,QOpenGLTexture::SRGB8_Alpha8, QOpenGLTexture::UInt8, false},
|
||||
{QOpenGLTexture::RGBA,QOpenGLTexture::SRGB8, QOpenGLTexture::UInt8, false},
|
||||
#else
|
||||
{QOpenGLTexture::RGB, QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, false},
|
||||
{QOpenGLTexture::RGBA,QOpenGLTexture::RGB8_UNorm, QOpenGLTexture::UInt8, false},
|
||||
#endif
|
||||
{QOpenGLTexture::RGB, QOpenGLTexture::RGB16_UNorm, QOpenGLTexture::UInt16, false},
|
||||
{QOpenGLTexture::RGBA, QOpenGLTexture::RGB16_UNorm, QOpenGLTexture::UInt16, false},
|
||||
{QOpenGLTexture::RGB, QOpenGLTexture::RGB32F, QOpenGLTexture::Float32, false}
|
||||
@@ -79,7 +84,9 @@ ImageWidget::ImageWidget(Database *database, QWidget *parent) : QOpenGLWidget(pa
|
||||
});
|
||||
|
||||
setMouseTracking(true);
|
||||
#ifdef COLOR_MANAGMENT
|
||||
setTextureFormat(GL_SRGB8_ALPHA8);
|
||||
#endif
|
||||
}
|
||||
|
||||
ImageWidget::~ImageWidget()
|
||||
@@ -290,7 +297,9 @@ void ImageWidget::paintGL()
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef COLOR_MANAGMENT
|
||||
if(m_srgb)f->glEnable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
m_vao->bind();
|
||||
m_image->bind(0);
|
||||
m_program->bind();
|
||||
@@ -301,7 +310,9 @@ void ImageWidget::paintGL()
|
||||
m_program->setUniformValue("bw", m_bwImg);
|
||||
m_program->setUniformValue("invert", m_invert);
|
||||
f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
#ifdef COLOR_MANAGMENT
|
||||
if(m_srgb)f->glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user