summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-06-02 13:50:13 +0200
committerKim Motoyoshi Kalland <kim.kalland@nokia.com>2010-06-02 14:18:01 +0200
commit85695ff1643be61eb0ef0dbae89c46ebad06c84d (patch)
tree21d94b9d8535e77a8e94d881e9f006556b86bdb1
parentb956e12165beb11e92f3d9b65aa488cd120ec6c8 (diff)
downloadqt4-tools-85695ff1643be61eb0ef0dbae89c46ebad06c84d.tar.gz
Added static version of QGLFramebufferObject::release().
The function is marked internal for now. Reviewed-by: Gunnar
-rw-r--r--src/opengl/qglframebufferobject.cpp30
-rw-r--r--src/opengl/qglframebufferobject.h2
2 files changed, 32 insertions, 0 deletions
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 890b029140..deffc2075b 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -1024,6 +1024,36 @@ QPaintEngine *QGLFramebufferObject::paintEngine() const
}
/*!
+ \fn bool QGLFramebufferObject::bindDefault()
+ \internal
+
+ Switches rendering back to the default, windowing system provided
+ framebuffer.
+ Returns true upon success, false otherwise.
+
+ \sa bind(), release()
+*/
+bool QGLFramebufferObject::bindDefault()
+{
+ QGLContext *ctx = const_cast<QGLContext *>(QGLContext::currentContext());
+
+ if (ctx) {
+ bool ext_detected = (QGLExtensions::glExtensions() & QGLExtensions::FramebufferObject);
+ if (!ext_detected || (ext_detected && !qt_resolve_framebufferobject_extensions(ctx)))
+ return false;
+
+ ctx->d_ptr->current_fbo = ctx->d_ptr->default_fbo;
+ glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->default_fbo);
+#ifdef QT_DEBUG
+ } else {
+ qWarning("QGLFramebufferObject::bindDefault() called without current context.");
+#endif
+ }
+
+ return ctx != 0;
+}
+
+/*!
\fn bool QGLFramebufferObject::hasOpenGLFramebufferObjects()
Returns true if the OpenGL \c{GL_EXT_framebuffer_object} extension
diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h
index 306b6ff39c..6ff66457f7 100644
--- a/src/opengl/qglframebufferobject.h
+++ b/src/opengl/qglframebufferobject.h
@@ -108,6 +108,8 @@ public:
QPaintEngine *paintEngine() const;
GLuint handle() const;
+ static bool bindDefault();
+
static bool hasOpenGLFramebufferObjects();
void drawTexture(const QRectF &target, GLuint textureId, GLenum textureTarget = GL_TEXTURE_2D);