Load DirectX model file with OpenSceneGraph<>
This question already has an answer here:
- Loading a .X model in DirectX 9 1 answer
Yes it is, apparently osgDB uses the file extension to load the proper plugin.
However, I'm not sure how well supported the .x file format is. I've been able to load a single model from the DX SDK (it wasn't pretty):
C:\OpenSceneGraph\bin>osgviewer.exe --window 10 10 600 600 "C:\Program Files\DXSDK\Samples\Media\Tiny\tiny.x"
Other attempts lead to a dark-blue background with nothing going on (and most of the attempts yield no errors either).
So, it's possible, but how your model should be made is unclear.
I tried again and it worked! For the record, here is my working code:
osg::ref_ptr<osg::Node> plane = osgDB::readNodeFile( "GeeBee2.x" ); osg::Image *img_plane = osgDB::readImageFile("Images/GeeBee.dds"); osg::Texture2D *tex_plane = new osg::Texture2D; tex_plane ->setImage(img_plane); plane->getOrCreateStateSet()->setTextureAttributeAndModes(0, tex_plane );