diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2012-01-26 11:44:05 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-27 10:58:32 +0100 |
commit | 2d39471897f0a3a769406ec9c2b39558ebd45af3 (patch) | |
tree | 8c417f4ba814e9dbe70e56bdbf8a13cc46b3827f /src/gui/opengl | |
parent | 365b5f7a9271e5fc503b10e6c17371d76643fc94 (diff) |
Introduced QOpenGLContext::defaultFramebufferObject().
Also add some debugging helpers to make sure applications are correctly
written even on less restrictive platforms.
Change-Id: Ie92e497c32e07b2b83662f7ab5540d8f37777fd0
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/gui/opengl')
-rw-r--r-- | src/gui/opengl/qopenglframebufferobject.cpp | 8 | ||||
-rw-r--r-- | src/gui/opengl/qopenglfunctions.cpp | 3 | ||||
-rw-r--r-- | src/gui/opengl/qopenglfunctions.h | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index bb723b7ce6..6cfb3c1b01 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -892,8 +892,8 @@ bool QOpenGLFramebufferObject::release() #endif if (current) { - current->d_func()->current_fbo = current->d_func()->default_fbo; - d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->d_func()->default_fbo); + current->d_func()->current_fbo = current->defaultFramebufferObject(); + d->funcs.glBindFramebuffer(GL_FRAMEBUFFER, current->d_func()->current_fbo); } return true; @@ -1057,8 +1057,8 @@ bool QOpenGLFramebufferObject::bindDefault() QOpenGLFunctions functions(ctx); if (ctx) { - ctx->d_func()->current_fbo = ctx->d_func()->default_fbo; - functions.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->default_fbo); + ctx->d_func()->current_fbo = ctx->defaultFramebufferObject(); + functions.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); #ifdef QT_DEBUG } else { qWarning("QOpenGLFramebufferObject::bindDefault() called without current context."); diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index b2a329067b..50f70d7408 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -478,6 +478,9 @@ void QOpenGLFunctions::initializeGLFunctions() Convenience function that calls glBindFramebuffer(\a target, \a framebuffer). + Note that Qt will translate a \a framebuffer argument of 0 to the currently + bound QOpenGLContext's defaultFramebufferObject(). + For more information, see the OpenGL/ES 2.0 documentation for \l{http://www.khronos.org/opengles/sdk/docs/man/glBindFramebuffer.xml}{glBindFramebuffer()}. */ diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index 99b35a3a93..d197ccac91 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -478,6 +478,8 @@ inline void QOpenGLFunctions::glBindBuffer(GLenum target, GLuint buffer) inline void QOpenGLFunctions::glBindFramebuffer(GLenum target, GLuint framebuffer) { + if (framebuffer == 0) + framebuffer = QOpenGLContext::currentContext()->defaultFramebufferObject(); #if defined(QT_OPENGL_ES_2) ::glBindFramebuffer(target, framebuffer); #else |