[Interest] QImage from ShaderEffectSource

manish sharma 83.manish at gmail.com
Mon Sep 15 18:20:35 CEST 2014


Thanks Gunnar, I might need this to be portable. I will figure out a way to
convert texture to fbo and as suggested will do something similar in
qt_gl_read_framebuffer.

Regards,
Manish

On Mon, Sep 15, 2014 at 11:49 AM, Gunnar Sletta <gunnar at sletta.org> wrote:

>
> On 13 Sep 2014, at 16:28, manish sharma <83.manish at gmail.com> wrote:
> >     void getImage()
> >     {
> >         qDebug() << "taking snapshot..!";
> >         disconnect(this, SIGNAL(afterRendering()), this,
> SLOT(getImage()));
> >         QSGTexture *texture =
> m_snapshotItem->textureProvider()->texture();
> >         texture->bind();
> >         GLint internalFormat;
> >         glGetTexLevelParameteriv(GL_TEXTURE_2D, 0,
> GL_TEXTURE_COMPONENTS, &internalFormat); // get internal format type of GL
> texture
> >         QImage img(texture->textureSize(),  QImage::Format_RGBX8888);
> >         glGetTexImage(GL_TEXTURE_2D, 0, internalFormat,
> GL_UNSIGNED_BYTE, img.bits());
>
> Actually, this bit down here, won't work on OpenGL ES as glGetTexImage
> doesn't exist there. You would need to bind the texture into a framebuffer
> object and glReadPixels it. If you're only deploying to desktop GL, this
> will not be a problem, but if you are targeting ES, including
> Windows/ANGLE, this code needs to be updated.
>
> cheers,
> Gunnar
>
> www.sletta.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140915/ad77ec2a/attachment.html>


More information about the Interest mailing list