diff options
3 files changed, 16 insertions, 2 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp index c2ec3db59..af1fb5675 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp +++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext.cpp @@ -705,6 +705,11 @@ void GraphicsContext::drawBuffer(GLenum mode) m_glHelper->drawBuffer(mode); } +void GraphicsContext::drawBuffers(GLsizei n, const int *bufs) +{ + m_glHelper->drawBuffers(n, bufs); +} + void GraphicsContext::applyUniform(const ShaderUniform &description, const UniformValue &v) { const UniformType type = m_glHelper->uniformTypeFromGLType(description.m_type); diff --git a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h index 82db57433..7bc79996c 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h +++ b/src/render/renderers/opengl/graphicshelpers/graphicscontext_p.h @@ -158,6 +158,7 @@ public: void pointSize(bool programmable, GLfloat value); void readBuffer(GLenum mode); void drawBuffer(GLenum mode); + void drawBuffers(GLsizei n, const int *bufs); void setMSAAEnabled(bool enabled); void setAlphaCoverageEnabled(bool enabled); void setClipPlane(int clipPlane, const QVector3D &normal, float distance); diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp index ecaa12d8b..20aca81bc 100644 --- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -1618,8 +1618,12 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId, if (!inputBufferIsDefault) readBuffer(GL_COLOR_ATTACHMENT0 + inputAttachmentPoint); - if (!outputBufferIsDefault) - drawBuffer(GL_COLOR_ATTACHMENT0 + outputAttachmentPoint); + if (!outputBufferIsDefault) { + // Note that we use glDrawBuffers, not glDrawBuffer. The + // latter is not available with GLES. + const int buf = outputAttachmentPoint; + drawBuffers(1, &buf); + } // Blit framebuffer const GLenum mode = interpolationMethod ? GL_NEAREST : GL_LINEAR; @@ -1629,6 +1633,10 @@ void SubmissionContext::blitFramebuffer(Qt3DCore::QNodeId inputRenderTargetId, // Reset draw buffer bindFramebuffer(lastDrawFboId, GraphicsHelperInterface::FBOReadAndDraw); + if (outputAttachmentPoint != QRenderTargetOutput::Color0) { + const int buf = QRenderTargetOutput::Color0; + drawBuffers(1, &buf); + } } } // namespace Render |