[osg-users] How to load an osg::Image into a qtwidget like Label

Andrea Martini martini.andrea at gmail.com
Thu Oct 15 00:48:35 PDT 2015


Hi,

I found a solution :


Code:
const uchar *qImageBuffer = (const uchar*)myOsgImage->data();

 QImage img(qImageBuffer, myOsgImage->s(), myOsgImage->t(), 
											  myOsgImage->getRowSizeInBytes(), 
											  QImage::Format_RGB888);

QPixmap pixmapObject;
pixmapObject.fromImage(img);

labelSelectedImage->setPixmap(QPixmap::fromImage(img)); // labelSelectedImage is a qt widget



It works, but i continue to get some problem with textures which contain alpha channel.



Thank you!

Cheers,
Andrea

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








More information about the osg-users mailing list