Hi Manish,
I'm just struggling with the same problem. I found on internet (maybe in this 
forum) a code example and I implemented the following method:


Code:
osg::Image* convertImage(const QImage& iImage)
{
   osg::Image* osgImage = new osg::Image();
   if (false == iImage.isNull()) {
      QImage glImage = QGLWidget::convertToGLFormat(iImage);
      if (false == glImage.isNull()) {
         unsigned char* data = new unsigned char[glImage.byteCount()];
         for(int i=0; i < glImage.byteCount(); ++i) {
            data[i] = glImage.bits()[i];
         }
         osgImage->setImage(glImage.width(), glImage.height(), 1, 4, GL_RGBA, 
GL_UNSIGNED_BYTE, data, osg::Image::USE_NEW_DELETE, 1);
      }
   }
   return osgImage;
}



Anyway, in my case this is not working well. A part from that, I'm not sure 
about "data" lifecycle.

Moreover, looking at 

<OpenSceneGraph>\src\osgQt\QGraphicsViewAdapter.cpp

you can find around informations on how to implement it. I'm currently 
investigating.

Cheers,
Gianni

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to