Thanks for your reply. That was very helpful, its working perfect now. 

Just a note for other who may have the same problem:

For 1. and 3.: I searched a little for some examples, so i found that the 
"osgphotoalbum" is exactly the example i needed. 

For QImage<->Texture conversion the following code did the trick, maybe it 
could be a little bit optimized:




Code:

// get QImage
QImage* tempqimage=YOUR_IMAGE_GETTER_FUNCTION();

// create OSG texture
osg::Texture2D* Texture = new osg::Texture2D;
Texture->setDataVariance(osg::Object::DYNAMIC);

// create OSG image
osg::Image* img = new osg::Image();
img->setAllocationMode(osg::Image::USE_NEW_DELETE);
img->setOrigin(osg::Image::TOP_LEFT);
img->allocateImage(tempqimage->width(), tempqimage->height(), 32, GL_RGBA, 
GL_UNSIGNED_BYTE  );

// convert QImage to ARGB (i tried RGB but it seems to be not working) 
QImage tempqimage2=tempqimage->convertToFormat(QImage::Format_ARGB32);
memcpy(img->data(),tempqimage2.bits(),tempqimage2.byteCount());

// assign the texture to the image
Texture->setImage(img);

delete tempqimage;




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





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to