OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

osgPlugins ReaderWriterRGB


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins]
View previous topic :: View next topic  
Author Message
miluit01
Newbie


Joined: 14 Jun 2016
Posts: 3

PostPosted: Tue Jun 14, 2016 7:38 pm    Post subject:
osgPlugins ReaderWriterRGB
Reply with quote

Hi,

I am trying to export the textures in osgb file into pic file. therefore i used ReaderWriterRGB:

Quote:

osg::StateSet::TextureAttributeList osg_texture_attribute_list = osg_state->getTextureAttributeList();

unsigned int texture_list_index = 0;
for (; texture_list_index < osg_texture_attribute_list.size(); ++texture_list_index) {

osg::Texture2D* texture = (osg::Texture2D*)(osg_state->getTextureAttribute(texture_list_index, osg::StateAttribute::TEXTURE));

if (texture) {
const osg::Image* image = texture->getImage();
if (image) {
if (!osgDB::writeImageFile(*image, image->getFileName())) {
BOOST_LOG_TRIVIAL(error) << "Write image failed";
}


But i got this exception:
Quote:
Warning: RGB plugin does not supporting writing compressed imagery.


my question is: how could i export the compressed texture image into a file?

Thank you!

Cheers,
Ming
Quote:
Back to top
View user's profile Send private message
miluit01
Newbie


Joined: 14 Jun 2016
Posts: 3

PostPosted: Wed Jun 15, 2016 7:50 am    Post subject:
Reply with quote

I found a interesting solution:

Code:

std::string texture_file_name =
osgDB::getStrippedName(image->getFileName());
texture_file_name += ".dds";
image->setFileName(texture_file_name);
osgDB::writeImageFile(*image, image->getFileName()


actually i just changed file extent name from rgb to dds...and it works...i get a lot dds file on disk...

I still don't get it...how it works...

maybe can somebody help me out to get a right way export compressed texture to file... Shocked
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11152

PostPosted: Wed Jun 15, 2016 8:22 am    Post subject:
osgPlugins ReaderWriterRGB
Reply with quote

Hi Ming,

Changing the file extension from .rgb (Which doesn't support
compressed textures) to .dds (which does) is the perfect solution in
your case. .dds is a much more complete image file format for modern
graphics needs - it supports compression and mipmapping, while the old
.rgb format is ancient and only supports non mip-mapped non compressed
images.

Robert.

On 15 June 2016 at 08:50, Ming Lu <> wrote:
Quote:
I found a interesting solution:


Code:

std::string texture_file_name =
osgDB::getStrippedName(image->getFileName());
texture_file_name += ".dds";
image->setFileName(texture_file_name);
osgDB::writeImageFile(*image, image->getFileName()




actually i just changed file extent name from rgb to dds...and it works...i get a lot dds file on disk...

I still don't get it...how it works...

maybe can somebody help me out to get a right way export compressed texture to file... :O

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67629#67629








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
miluit01
Newbie


Joined: 14 Jun 2016
Posts: 3

PostPosted: Wed Jun 15, 2016 3:21 pm    Post subject:
Re: osgPlugins ReaderWriterRGB
Reply with quote

Hi Robert,

thanks for reply!
Perfect.
I will take dds. Smile Razz
as experiment i used bmp format. files could be created but doesn't look correctly.
when i get your opinion correctly: dds is only supported format for compressed texture?

Best
Ming

robertosfield wrote:
Hi Ming,

Changing the file extension from .rgb (Which doesn't support
compressed textures) to .dds (which does) is the perfect solution in
your case. .dds is a much more complete image file format for modern
graphics needs - it supports compression and mipmapping, while the old
.rgb format is ancient and only supports non mip-mapped non compressed
images.

Robert.

On 15 June 2016 at 08:50, Ming Lu <> wrote:
Quote:
I found a interesting solution:


Code:

std::string texture_file_name =
osgDB::getStrippedName(image->getFileName());
texture_file_name += ".dds";
image->setFileName(texture_file_name);
osgDB::writeImageFile(*image, image->getFileName()




actually i just changed file extent name from rgb to dds...and it works...i get a lot dds file on disk...

I still don't get it...how it works...

maybe can somebody help me out to get a right way export compressed texture to file... Shocked

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67629#67629








------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts osgPlugins gles error MSB3191: Unable... robertosfield Submission 3 Wed Oct 05, 2016 12:45 pm View latest post
No new posts Mac OSX code signing and osgPlugins dir Alistair Baxter General 1 Thu Apr 07, 2016 3:52 pm View latest post
No new posts osgPlugins / ive dcfennell Plugins [osgPlugins] 0 Tue Jan 05, 2016 5:31 pm View latest post
No new posts [osgPlugins] dae plugin writer: movin... Aitor Moreno Submission 0 Fri Sep 25, 2015 6:20 am View latest post
No new posts Android osgPlugins Christian Kehl General 69 Mon Apr 13, 2015 9:41 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP