[Interest] Rendering to a QOpenGLFramebufferObject and Qt3D

Juan umrk.bimbo at gmail.com
Mon Apr 15 18:35:13 CEST 2013


Hi.

I want to apply a post-render shader using Qt3D (eg, tilt-shift).

In order to do that, I
(1) create a QOpenGLFramebufferObject *fbo and
a QGLFramebufferObjectSurface;
(2) render the nodes to the fbo surface
(via painter->pushSurface(fbo_surface))
(3) create a texture using the fbo as follows: QGLTexture2D *tex =
QGLTexture2D::fromTextureId(fbo->texture(), fbo->size())
(4) render a rectangle using that texture (via a QGLSceneNode
and node->material()->setTexture(tex)).

Now, that does not render anything. However, if I change (3) by
(3') create a texture using the fbo as follows:
    QGLTexture2D *tex = new QGLTexture2D;
    QImage img = fbo->toImage();
    tex->setImage(img);
then it works.

That means that I am successfully rendering into the FBO, because I can get
the result from it. But I can only do it by invoking fbo->toImage(), which
is slow. I would like to get the FBO content as a texture, via
QGLTexture2D::fromTextureId(fbo->texture(), fbo->size()).

Do you know anything I could do in order to make it work?

There may be a multisampling problem or something like that. Do you know
how to force everything to be not multisample? I don't think the problem is
along these lines - I just mention this because I already know that this
doesn't work in the multisample setting.

Thanks!
Juan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130415/ca3bb702/attachment.html>


More information about the Interest mailing list