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/qopenglframebufferobject.h | |
parent | c173a5071906867de9da26ee8f49224b23c2ef1d (diff) |
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/qopenglframebufferobject.h')
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h index 4ce0ee26cb..cead4ad10f 100644 --- a/src/gui/opengl/qopenglframebufferobject.h +++ b/src/gui/opengl/qopenglframebufferobject.h @@ -63,15 +63,18 @@ public: QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D); QOpenGLFramebufferObject(const QSize &size, Attachment attachment, - GLenum target = GL_TEXTURE_2D, GLenum internal_format = 0); + GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0); QOpenGLFramebufferObject(int width, int height, Attachment attachment, - GLenum target = GL_TEXTURE_2D, GLenum internal_format = 0); + GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0); QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format); QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format); virtual ~QOpenGLFramebufferObject(); + void addColorAttachment(const QSize &size, GLenum internalFormat = 0); + void addColorAttachment(int width, int height, GLenum internalFormat = 0); + QOpenGLFramebufferObjectFormat format() const; bool isValid() const; @@ -83,12 +86,19 @@ public: int height() const { return size().height(); } GLuint texture() const; + QVector<GLuint> textures() const; + GLuint takeTexture(); + GLuint takeTexture(int colorAttachmentIndex); + QSize size() const; + QVector<QSize> sizes() const; + QImage toImage() const; QImage toImage(bool flipped) const; - Attachment attachment() const; + QImage toImage(bool flipped, int colorAttachmentIndex) const; + Attachment attachment() const; void setAttachment(Attachment attachment); GLuint handle() const; @@ -100,6 +110,12 @@ public: static bool hasOpenGLFramebufferBlit(); static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, + GLbitfield buffers, + GLenum filter, + int readColorAttachmentIndex, + int drawColorAttachmentIndex); + static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, + QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST); static void blitFramebuffer(QOpenGLFramebufferObject *target, |