summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglfunctions.cpp
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2025-09-16 15:08:20 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2025-09-23 15:28:51 +0000
commit676e3745f5c7e91d6186cfe236a9fd18dd3def7c (patch)
tree4e951f506467adf88cc626a2b6a51966631a0784 /src/gui/opengl/qopenglfunctions.cpp
parent2f91d024a70698853b8cdb9658e5e11a6e1c385a (diff)
Enable NPOTT features for OpenGL ES >= 3
Fix "Attempted to use an unsupported filtering or wrap mode ..." warning on WebGL. OpenGL ES 3 requires support for non-power-of-two textures, but implementations may not provide the extensions. Change-Id: I613743e971238cfdd5da4267c01fdf60962c204e Pick-to: 6.10 Reviewed-by: Even Oscar Andersen <even.oscar.andersen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/opengl/qopenglfunctions.cpp')
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 7eef9956b65..6b45d26fb4c 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -234,11 +234,17 @@ static int qt_gl_resolve_features()
QOpenGLFunctions::CompressedTextures |
QOpenGLFunctions::Multisample |
QOpenGLFunctions::StencilSeparate;
- if (extensions.match("GL_IMG_texture_npot"))
- features |= QOpenGLFunctions::NPOTTextures;
- if (extensions.match("GL_OES_texture_npot"))
+
+ if (ctx->format().majorVersion() >= 3) {
features |= QOpenGLFunctions::NPOTTextures |
QOpenGLFunctions::NPOTTextureRepeat;
+ } else {
+ if (extensions.match("GL_IMG_texture_npot"))
+ features |= QOpenGLFunctions::NPOTTextures;
+ if (extensions.match("GL_OES_texture_npot"))
+ features |= QOpenGLFunctions::NPOTTextures |
+ QOpenGLFunctions::NPOTTextureRepeat;
+ }
if (ctx->format().majorVersion() >= 3 || extensions.match("GL_EXT_texture_rg"))
features |= QOpenGLFunctions::TextureRGFormats;
if (ctx->format().majorVersion() >= 3) {