summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopenglframebufferobject_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/opengl/qopenglframebufferobject_p.h')
-rw-r--r--src/gui/opengl/qopenglframebufferobject_p.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject_p.h b/src/gui/opengl/qopenglframebufferobject_p.h
index f0e07f2119..bd830b38e9 100644
--- a/src/gui/opengl/qopenglframebufferobject_p.h
+++ b/src/gui/opengl/qopenglframebufferobject_p.h
@@ -70,7 +70,12 @@ public:
mipmap(false)
{
#ifndef QT_OPENGL_ES_2
- internal_format = QOpenGLFunctions::isES() ? GL_RGBA : GL_RGBA8;
+ // There is nothing that says QOpenGLFramebufferObjectFormat needs a current
+ // context, so we need a fallback just to be safe, even though in pratice there
+ // will usually be a context current.
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ const bool isES = ctx ? ctx->isES() : QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL;
+ internal_format = isES ? GL_RGBA : GL_RGBA8;
#else
internal_format = GL_RGBA;
#endif