Hi John, Right. grabFramebuffer() won't suffice since you need to specify a custom size. So use your own QOpenGLFramebufferObject with the desired size and then call toImage(), similarly to this:
w.makeCurrent(); // w is a QOpenGLWidget QOpenGLFramebufferObject fbo(size, QOpenGLFramebufferObject::CombinedDepthStencil); fbo.bind(); ... // draw fbo.release(); img = fbo.toImage(); Cheers, Laszlo ________________________________________ From: interest-bounces+laszlo.agocs=theqtcompany....@qt-project.org <interest-bounces+laszlo.agocs=theqtcompany....@qt-project.org> on behalf of John Weeks <j...@wavemetrics.com> Sent: Monday, November 24, 2014 6:12 PM To: interest Subject: Re: [Interest] QWindow::setTransientParent() > renderPixmap() can be replaced with a call to grabFramebuffer(). They both > perform (potentially expensive) readbacks. Thanks Laszlo. The expense is probably OK, since this is for exporting graphics as a file or on the clipboard. But grabFramebuffer() gives you the same resolution as on screen, and we need hi-res export. I ran across some code in a JIRA bug using QGLFramebufferObject; I see there is also QOpenGLFramebufferObject so I guess we can use the same technique. -John Weeks _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest