diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-06-10 17:43:59 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-07-29 07:54:13 +0000 |
commit | 06b86f68e8ddb1bbadd5adc14067f92c896ead93 (patch) | |
tree | 58242a9c91fc41eb393d95b36f4531f7bd5c56f5 /src/gui/opengl/qopenglfunctions.cpp | |
parent | c173a5071906867de9da26ee8f49224b23c2ef1d (diff) | |
download | qtbase-06b86f68e8ddb1bbadd5adc14067f92c896ead93.tar.gz |
Support MRT in QOpenGLFramebufferObject
Introduce overloads in the API to allow specifying multiple color
attachment sizes and formats. When these are in use and MRT is supported,
a texture or renderbuffer is created for each of GL_COLOR_ATTACHMENT0, 1, 2, ...
[ChangeLog] Added support for multiple render targets in QOpenGLFramebufferObject
Task-number: QTBUG-39235
Change-Id: Ie7cfd81d1b796a9166b80dff7513aafe0120d53d
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Diffstat (limited to 'src/gui/opengl/qopenglfunctions.cpp')
-rw-r--r-- | src/gui/opengl/qopenglfunctions.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 8f3959189d..668eaa9a89 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -184,6 +184,7 @@ Q_LOGGING_CATEGORY(lcGLES3, "qt.opengl.es3") \value NPOTTextureRepeat Non power of two textures can use GL_REPEAT as wrap parameter. \value FixedFunctionPipeline The fixed function pipeline is available. \value TextureRGFormats The GL_RED and GL_RG texture formats are available. + \value MultipleRenderTargets Multiple color attachments to framebuffer objects are available. */ // Hidden private fields for additional extension data. @@ -275,7 +276,7 @@ static int qt_gl_resolve_features() { QOpenGLContext *ctx = QOpenGLContext::currentContext(); if (ctx->isOpenGLES()) { - // OpenGL ES 2 + // OpenGL ES int features = QOpenGLFunctions::Multitexture | QOpenGLFunctions::Shaders | QOpenGLFunctions::Buffers | @@ -300,6 +301,8 @@ static int qt_gl_resolve_features() if (!(renderer && strstr(renderer, "Mesa"))) features |= QOpenGLFunctions::TextureRGFormats; } + if (ctx->format().majorVersion() >= 3) + features |= QOpenGLFunctions::MultipleRenderTargets; return features; } else { // OpenGL @@ -308,10 +311,9 @@ static int qt_gl_resolve_features() QOpenGLExtensionMatcher extensions; if (format.majorVersion() >= 3) - features |= QOpenGLFunctions::Framebuffers; - else if (extensions.match("GL_EXT_framebuffer_object") || - extensions.match("GL_ARB_framebuffer_object")) - features |= QOpenGLFunctions::Framebuffers; + features |= QOpenGLFunctions::Framebuffers | QOpenGLFunctions::MultipleRenderTargets; + else if (extensions.match("GL_EXT_framebuffer_object") || extensions.match("GL_ARB_framebuffer_object")) + features |= QOpenGLFunctions::Framebuffers | QOpenGLFunctions::MultipleRenderTargets; if (format.majorVersion() >= 2) { features |= QOpenGLFunctions::BlendColor | |