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 <gun...@sletta.org> wrote: > > On 13 Sep 2014, at 16:28, manish sharma <83.man...@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 > >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest