Hi,
This is an example of how i convert QImage to osg::texture:
NOTE: (lt) is "less than", for some reason the forum as eating everything after
that symbol.
Code:
QImage i(/path/to/image.png");
QImage img = QGLWidget::convertToGLFormat(i);
unsigned char* data = new unsigned char[img.byteCount()];
for(int i=0; i(lt)img.byteCount(); i++)
{
data[i] = img.bits()[i];
}
osg::Image* sym = new osg::Image();
sym->setImage(img.width(), img.height(), 1, 4, GL_RGBA, GL_UNSIGNED_BYTE, data,
osg::Image::USE_NEW_DELETE, 1);
osg::Texture2D* texture = new osg::Texture2D(sym);
Thank you!
Cheers,
Chuck
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36040#36040
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org