Hi,
thank you for your reply. Sorry I didn’t see the answer the other day. While I was waiting for an answer, I solved it by loading the resource with Qt and converting the image to OSG.
Anyway, it is interesting the solution you provide, so I may try to implement it at some point.
Thank you!
Cheers!
From: [email protected] [mailto:[email protected]] On Behalf Of Sergey Polischuk
Sent: viernes, 11 de mayo de 2012 10:46
To: OpenSceneGraph Users
Subject: Re: [osg-users] Load images from resources file (rc)
As long as you know how to get raw data stream from wherever your resources are - you can write osgDB::ReadFileCallback where you override methods like
MyReadFileCallback::result_t
MyReadFileCallback::readObject(const std::string& filename, const osgDB::Options* options)
{//create stream which contain unpacked data of your file
int ext_pos;
if ((ext_pos = filename.find_last_of(".")) > 0)
{
std::string fileext = filename.substr(ext_pos + 1);
osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension(fileext);
if (rw)
return rw->readObject(stream, options);
}
return MyReadFileCallback::result_t();
}
You should register your read file callback in osgDB::Registry with osgDB::Registry::instance()->setReadFileCallback(...) prior to loading stuff.
Cheers,
Sergey
11.05.2012, 11:07, "Héctor Martínez" <[email protected]>:
Hi,
does anybody know if it is possible to load images from a ‘.rc’ file in osg using osgDB::readImageFile?
Thanks in advance
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

