summaryrefslogtreecommitdiffstats
path: root/src/opengl/qopenglframebufferobject.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <[email protected]>2025-03-04 15:48:01 +0200
committerTarja Sundqvist <[email protected]>2025-03-04 15:48:01 +0200
commit3fe9e69e4d7510480544f928e8a07f0f110b2181 (patch)
treed401a866a8c636f912dc2fec434a414a65135957 /src/opengl/qopenglframebufferobject.cpp
parente0c1e5a6f56a3dee20714830ff526d796b993430 (diff)
parentfdf57f5df57e7d12cf871699d857a71acf272e0c (diff)
Merge tag 'v6.5.5-lts-lgpl' into 6.5
Qt 6.5.5-lts-lgpl release
Diffstat (limited to 'src/opengl/qopenglframebufferobject.cpp')
-rw-r--r--src/opengl/qopenglframebufferobject.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/opengl/qopenglframebufferobject.cpp b/src/opengl/qopenglframebufferobject.cpp
index 379c59a827d..5c8f769d399 100644
--- a/src/opengl/qopenglframebufferobject.cpp
+++ b/src/opengl/qopenglframebufferobject.cpp
@@ -550,8 +550,22 @@ void QOpenGLFramebufferObjectPrivate::initTexture(int idx)
else if (color.internalFormat == GL_RGB16F || color.internalFormat == GL_RGBA16F)
pixelType = GL_HALF_FLOAT;
+ bool isOpaque = false;
+ switch (color.internalFormat) {
+ case GL_RGB8:
+ case GL_RGB16:
+ case GL_RGB16F:
+ case GL_RGB32F:
+ isOpaque = true;
+ break;
+ case GL_RGB10:
+ // opaque but the pixel type (INT_2_10_10_10) has alpha and so requires RGBA texture format
+ break;
+ }
+ const GLuint textureFormat = isOpaque ? GL_RGB : GL_RGBA;
+
funcs.glTexImage2D(target, 0, color.internalFormat, color.size.width(), color.size.height(), 0,
- GL_RGBA, pixelType, nullptr);
+ textureFormat, pixelType, nullptr);
if (format.mipmap()) {
int width = color.size.width();
int height = color.size.height();
@@ -560,8 +574,8 @@ void QOpenGLFramebufferObjectPrivate::initTexture(int idx)
width = qMax(1, width >> 1);
height = qMax(1, height >> 1);
++level;
- funcs.glTexImage2D(target, level, color.internalFormat, width, height, 0,
- GL_RGBA, pixelType, nullptr);
+ funcs.glTexImage2D(target, level, color.internalFormat, width, height, 0, textureFormat,
+ pixelType, nullptr);
}
}
funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + idx,