openscenegraph / OpenSceneGraph

OpenSceneGraph git repository
http://www.openscenegraph.org
Other
3.21k stars 1.42k forks source link

how to load the image in (Qt)qrc file by osgDB::readImageFile(const std::string &) #1312

Closed shaozhihua closed 6 months ago

shaozhihua commented 6 months ago

I called the function "osg::Image* readImageFile(const std::string& filename)" in Qt programe; but I found that this function can not load qrc url, I search the solution on internet,I found this: https://osg-users.openscenegraph.narkive.com/LxqDeVJT/qt-resouce-and-osgdb-readimagefile it is the solution in ten years ago,not today. I guess. so I hope someone who can help me out from this question.. thank you very much!

OS: Windows11 Qt Version: Qt5.15.2 Compiler: MSVC2019 OsgVersion: 3.6.5 MyMood: confused Lunch: Noodles

robertosfield commented 6 months ago

The OSG is not designed to directly support this, if you want to do it then you are outside the core functionality and will have to try novel approaches, if the above approach doesn't work then perhaps just load the image via Qt then copy the data across to an osg::Image.