Here is my method:

    QImage glimg(QGLWidget::convertToGLFormat(img->image())); //image() is the 
QImage
    osg::Image* osgImg = new osg::Image;
    unsigned char* bits = new unsigned char[glimg.byteCount()];
    memcpy(bits, glimg.bits(),glimg.byteCount());
    osgImg->setImage(img->pixelWidth(), img->pixelHeight(), 1, GL_RGBA, 
GL_RGBA, GL_UNSIGNED_BYTE, bits, osg::Image::USE_NEW_DELETE);



-----Original Message-----
From: osg-users [mailto:[email protected]] On Behalf 
Of manish Choudhary
Sent: Thursday, December 04, 2014 4:18 AM
To: [email protected]
Subject: [osg-users] To Convert QImage to OSG::Image

Hi,

In my application I required to convert QImage to osg::Image to use that as a 
texture to wrap it on model.
What is the best way to convert QImage to Osg::Image ?


Thank you!

Cheers,
manish

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61976#61976





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
This email and any files transmitted with it from The Charles Machine Works, 
Inc. are confidential and intended solely for the use of the individual or 
entity to which they are addressed. If you have received this email in error 
please notify the sender. Our company accepts no liability for the contents of 
this email, or for the consequences of any actions taken on the basis of the 
information provided, unless that information is subsequently confirmed in 
writing. Please note that any views or opinions presented in this email are 
solely those of the author and do not necessarily represent those of the 
company. Finally, the recipient should check this email and any attachments for 
the presence of viruses. The company accepts no liability for any damage caused 
by any virus transmitted by this email.
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to