diff options
Diffstat (limited to 'src/render')
3 files changed, 29 insertions, 21 deletions
diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp index 798457edb..2b2645505 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp +++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes2.cpp @@ -63,15 +63,6 @@ QT_BEGIN_NAMESPACE #define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 #endif -// ES 2.0 FBO -#ifndef GL_DRAW_FRAMEBUFFER -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#endif - -#ifndef GL_READ_FRAMEBUFFER -#define GL_READ_FRAMEBUFFER 0x8CA8 -#endif - namespace Qt3DRender { namespace Render { @@ -371,18 +362,10 @@ void GraphicsHelperES2::releaseFrameBufferObject(GLuint frameBufferId) void GraphicsHelperES2::bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) { - switch (mode) { - case FBODraw: - m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); - return; - case FBORead: - m_funcs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); - return; - case FBOReadAndDraw: - default: - m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); - return; - } + Q_UNUSED(mode) + // For ES2 the spec states for target: The symbolic constant must be GL_FRAMEBUFFER + // so mode is ignored and is always set to GL_FRAMEBUFFER + m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); } GLuint GraphicsHelperES2::boundFrameBufferObject() diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp index d324baf1f..87a160a85 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp +++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3.cpp @@ -139,6 +139,14 @@ QT_BEGIN_NAMESPACE #define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 #endif +#ifndef GL_DRAW_FRAMEBUFFER +#define GL_DRAW_FRAMEBUFFER 0x8CA9 +#endif + +#ifndef GL_READ_FRAMEBUFFER +#define GL_READ_FRAMEBUFFER 0x8CA8 +#endif + namespace Qt3DRender { namespace Render { @@ -267,6 +275,22 @@ void GraphicsHelperES3::bindFrameBufferAttachment(QOpenGLTexture *texture, const texture->release(); } +void GraphicsHelperES3::bindFrameBufferObject(GLuint frameBufferId, GraphicsHelperInterface::FBOBindMode mode) +{ + switch (mode) { + case FBODraw: + m_funcs->glBindFramebuffer(GL_DRAW_FRAMEBUFFER, frameBufferId); + return; + case FBORead: + m_funcs->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBufferId); + return; + case FBOReadAndDraw: + default: + m_funcs->glBindFramebuffer(GL_FRAMEBUFFER, frameBufferId); + return; + } +} + bool GraphicsHelperES3::supportsFeature(GraphicsHelperInterface::Feature feature) const { switch (feature) { diff --git a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h index 518226116..1df710625 100644 --- a/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h +++ b/src/render/renderers/opengl/graphicshelpers/graphicshelperes3_p.h @@ -69,6 +69,7 @@ public: void bindBufferBase(GLenum target, GLuint index, GLuint buffer) override; bool frameBufferNeedsRenderBuffer(const Attachment &attachment) override; void bindFrameBufferAttachment(QOpenGLTexture *texture, const Attachment &attachment) override; + void bindFrameBufferObject(GLuint frameBufferId, FBOBindMode mode) override; void bindUniformBlock(GLuint programId, GLuint uniformBlockIndex, GLuint uniformBlockBinding) override; void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) override; void buildUniformBuffer(const QVariant &v, const ShaderUniform &description, QByteArray &buffer) override; |