From 890648a91b266a889ac5c4d20acad2fe8ecb11e3 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 1 Jul 2011 08:19:52 +0200 Subject: Support setting an FBO as the render target for a canvas Change-Id: I8049580f1d2b27d6ebc4d595712939338c01b711 Reviewed-on: http://codereview.qt.nokia.com/986 Reviewed-by: Qt Sanity Bot Reviewed-by: Gunnar Sletta --- src/declarative/scenegraph/qsgcontext.cpp | 10 ++++++++-- src/declarative/scenegraph/qsgcontext_p.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'src/declarative/scenegraph') diff --git a/src/declarative/scenegraph/qsgcontext.cpp b/src/declarative/scenegraph/qsgcontext.cpp index 682b514b9c..f5a082ba06 100644 --- a/src/declarative/scenegraph/qsgcontext.cpp +++ b/src/declarative/scenegraph/qsgcontext.cpp @@ -246,14 +246,20 @@ bool QSGContext::isReady() const } -void QSGContext::renderNextFrame() +void QSGContext::renderNextFrame(QGLFramebufferObject *fbo) { Q_D(QSGContext); emit d->engine.beforeRendering(); cleanupTextures(); - d->renderer->renderScene(); + + if (fbo) { + BindableFbo bindable(fbo); + d->renderer->renderScene(bindable); + } else { + d->renderer->renderScene(); + } emit d->engine.afterRendering(); diff --git a/src/declarative/scenegraph/qsgcontext_p.h b/src/declarative/scenegraph/qsgcontext_p.h index 1344ac705d..5ce2e9e80b 100644 --- a/src/declarative/scenegraph/qsgcontext_p.h +++ b/src/declarative/scenegraph/qsgcontext_p.h @@ -65,6 +65,7 @@ class QSGMaterialShader; class QSGEngine; class QGLContext; +class QGLFramebufferObject; class Q_DECLARATIVE_EXPORT QSGContext : public QObject { @@ -89,7 +90,7 @@ public: QSGMaterialShader *prepareMaterial(QSGMaterial *material); - virtual void renderNextFrame(); + virtual void renderNextFrame(QGLFramebufferObject *fbo = 0); virtual QSGRectangleNode *createRectangleNode(); virtual QSGImageNode *createImageNode(); -- cgit v1.2.3