Re: [osg-users] How to apply textures to a model in openscenegraph?
If you have a need to actually change the flt file itself to change it to use dds textures, you can write something using the openFLT API. I actually just very recently did this myself. We had several hundred models we were converting to use dds instead of rgb files. The samples given with the API and the documentation should be good enough if you go that route. Look at the egwalk example to figure out how to drill down the structure. To actually change the name you will need to use the mgGetFirstTexture, mgGetTextureSaveName, and mgGetNextTexture. That took me a while to figure out.. -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Lokesh kumar Sent: Thursday, May 23, 2013 6:02 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] How to apply textures to a model in openscenegraph? Robert Osfield robert.osfield@... writes: Hi Lokesh, The easist thing to do would be to use osgconv to convert the files to native OSG binary format .osgb and have osgconv do the compression for you. Use osgconv --help for the options. The other alternative to to write your own osgDB::Registry::ReadFile callback that intercepts the readImage calls and changes the filename to the .dds equivalent. Robert. Thank you Robert!! I'm interested in your 2nd alternative :- using osgDB::Registry::ReadFile but, i'm Newbie in openscenegraph. can you give a short example. Regards -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
You don't even need to use the openflight api (is it freelebly available?). Go download the OpenFlight spec from the Presagis website (it is free) and write something that will change the texture name in the openflight texture palette. If you are after using dds instead of rgb you change only the extension in the palette. I have done this several times. Nick On Fri, May 24, 2013 at 4:59 PM, Cary, Karl A. karl.a.c...@saic.com wrote: If you have a need to actually change the flt file itself to change it to use dds textures, you can write something using the openFLT API. I actually just very recently did this myself. We had several hundred models we were converting to use dds instead of rgb files. The samples given with the API and the documentation should be good enough if you go that route. Look at the egwalk example to figure out how to drill down the structure. To actually change the name you will need to use the mgGetFirstTexture, mgGetTextureSaveName, and mgGetNextTexture. That took me a while to figure out.. -Original Message- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Lokesh kumar Sent: Thursday, May 23, 2013 6:02 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] How to apply textures to a model in openscenegraph? Robert Osfield robert.osfield@... writes: Hi Lokesh, The easist thing to do would be to use osgconv to convert the files to native OSG binary format .osgb and have osgconv do the compression for you. Use osgconv --help for the options. The other alternative to to write your own osgDB::Registry::ReadFile callback that intercepts the readImage calls and changes the filename to the .dds equivalent. Robert. Thank you Robert!! I'm interested in your 2nd alternative :- using osgDB::Registry::ReadFile but, i'm Newbie in openscenegraph. can you give a short example. Regards -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or g ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to apply textures to a model in openscenegraph?
Hi, I have a flt model and multiple *.dds texture files in a Directory :- my folder contains :- (1) terrain.flt (2) road.dds (3) buildings.dds (4) banners.dds I know how to read and apply single .dds texture file to my model (terrain.flt) :- osg::ref_ptrosg::Node terrainModel (osgDB::readNodeFile (c:/my_folder/terrain.flt)); osg::ref_ptrosg::Texture2D tex (new osg::Texture2D); osg::ref_ptrosg::Image image (osgDB::readImageFile (c:/my_folder/road.dds )); tex-setImage(image.get()); osg::ref_ptrosg::StateSet state=terrainModel-getOrCreateStateSet(); state-setTextureAttributeAndModes(0,tex.get (),osg::StateAttribute::ON); but i don't know how to read and apply all these textures to my model (terrain.flt). Help me. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Hi Lokesh, Your OpenFlight model references all the textures it needs, and if you want to replace or apply new ones you should simply reload the model in Creator or other compatible modelling tool and apply the changes you need then save again. Robert. On 23 May 2013 07:58, Lokesh Kumar lokeshkumar.2...@msit.in wrote: Hi, I have a flt model and multiple *.dds texture files in a Directory :- my folder contains :- (1) terrain.flt (2) road.dds (3) buildings.dds (4) banners.dds I know how to read and apply single .dds texture file to my model (terrain.flt) :- osg::ref_ptrosg::Node terrainModel (osgDB::readNodeFile (c:/my_folder/terrain.flt)); osg::ref_ptrosg::Texture2D tex (new osg::Texture2D); osg::ref_ptrosg::Image image (osgDB::readImageFile (c:/my_folder/road.dds )); tex-setImage(image.get()); osg::ref_ptrosg::StateSet state=terrainModel-getOrCreateStateSet(); state-setTextureAttributeAndModes(0,tex.get (),osg::StateAttribute::ON); but i don't know how to read and apply all these textures to my model (terrain.flt). Help me. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Robert Osfield robert.osfield@... writes: Hi Lokesh, Your OpenFlight model references all the textures it needs, and if you want to replace or apply new ones you should simply reload the model in Creator or other compatible modelling tool and apply the changes you need then save again. Robert. hi Robert, I have a FLT model which has references to *.tga texture files(with proper UV mapping). i converted these *.tga files into *.dds texture files using Nvidia DDS utility tool (nvdxt.exe). now, i want to load and apply these *.dds texture files to my original FLT model. -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Hi Lokesh, The easist thing to do would be to use osgconv to convert the files to native OSG binary format .osgb and have osgconv do the compression for you. Use osgconv --help for the options. The other alternative to to write your own osgDB::Registry::ReadFile callback that intercepts the readImage calls and changes the filename to the .dds equivalent. Robert. On 23 May 2013 09:38, Lokesh kumar lokeshkumar.2...@msit.in wrote: Robert Osfield robert.osfield@... writes: Hi Lokesh, Your OpenFlight model references all the textures it needs, and if you want to replace or apply new ones you should simply reload the model in Creator or other compatible modelling tool and apply the changes you need then save again. Robert. hi Robert, I have a FLT model which has references to *.tga texture files(with proper UV mapping). i converted these *.tga files into *.dds texture files using Nvidia DDS utility tool (nvdxt.exe). now, i want to load and apply these *.dds texture files to my original FLT model. -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Hello Lokesh A hack for testing would be to rename the references in the binary flt. But this should be done for testing of course. Another option is to run a visitor over the loaded model an replace the texture file name references with the new extension. cheers Sebastian Robert Osfield robert.osfield@... writes: Hi Lokesh, Your OpenFlight model references all the textures it needs, and if you want to replace or apply new ones you should simply reload the model in Creator or other compatible modelling tool and apply the changes you need then save again. Robert. hi Robert, I have a FLT model which has references to *.tga texture files(with proper UV mapping). i converted these *.tga files into *.dds texture files using Nvidia DDS utility tool (nvdxt.exe). now, i want to load and apply these *.dds texture files to my original FLT model. -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Robert Osfield robert.osfield@... writes: Hi Lokesh, The easist thing to do would be to use osgconv to convert the files to native OSG binary format .osgb and have osgconv do the compression for you. Use osgconv --help for the options. The other alternative to to write your own osgDB::Registry::ReadFile callback that intercepts the readImage calls and changes the filename to the .dds equivalent. Robert. Thank you Robert!! I'm interested in your 2nd alternative :- using osgDB::Registry::ReadFile but, i'm Newbie in openscenegraph. can you give a short example. Regards -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to apply textures to a model in openscenegraph?
Hi Lokesh in http://www.packtpub.com/openscenegraph-3-0-beginners-guide/book on support tab for the page of the book you may download sample code, in \2824_12_Code\2824_12_Code folder from download zip there is sharing_textures.cpp which has a class class ReadAndShareImageCallback : public osgDB::ReadFileCallback you are looking for as example make something similar, but before loading texture - change extension of loaded image I recommend to get existing osg books and read them - it will save you a lot of time. In India see http://www.junglee.com/mn/search/junglee/ref=nav_sb_noss?url=search-alias%3Dstripbooksfield-keywords=openscenegraph Regards Sergey ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Totally agree on the OSG books. They are must-read. 2013/5/23 Sergey Kurdakov sergey.fo...@gmail.com Hi Lokesh in http://www.packtpub.com/openscenegraph-3-0-beginners-guide/book on support tab for the page of the book you may download sample code, in \2824_12_Code\2824_12_Code folder from download zip there is sharing_textures.cpp which has a class class ReadAndShareImageCallback : public osgDB::ReadFileCallback you are looking for as example make something similar, but before loading texture - change extension of loaded image I recommend to get existing osg books and read them - it will save you a lot of time. In India see http://www.junglee.com/mn/search/junglee/ref=nav_sb_noss?url=search-alias%3Dstripbooksfield-keywords=openscenegraph Regards Sergey ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Sergey Kurdakov sergey.forum@... writes: Hi Lokesh in http://www.packtpub.com/openscenegraph-3-0-beginners-guide/book on support tab for the page of the book you may download sample code, in \2824_12_Code\2824_12_Code folder from download zip there is sharing_textures.cpp which has a class class ReadAndShareImageCallback : public osgDB::ReadFileCallback you are looking for as example make something similar, but before loading texture - change extension of loaded image I recommend to get existing osg books and read them - it will save you a lot of time. In India see http://www.junglee.com/mn/search/junglee/ref=nav_sb_noss?url=search-alias%3Dstripbooksfield-keywords=openscenegraph Regards Sergey Thank you Sergey Kurdakov, Openscenegarph 3.0 cookbook seems quite comprehensive. so, i'm going for it. really helpful. -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org