[osg-users] [osgPlugins] osgPlugins ReaderWriterRGB

66 views
Skip to first unread message

Ming Lu

unread,
Jun 14, 2016, 5:21:26 PM6/14/16
to osg-...@lists.openscenegraph.org
Hi,

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


>
> 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:
> 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
>


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





_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Ming Lu

unread,
Jun 15, 2016, 3:42:28 AM6/15/16
to osg-...@lists.openscenegraph.org
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

Robert Osfield

unread,
Jun 15, 2016, 4:14:24 AM6/15/16
to OpenSceneGraph Users
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.

Ming Lu

unread,
Jun 15, 2016, 11:13:28 AM6/15/16
to osg-...@lists.openscenegraph.org
Hi Robert,

thanks for reply!
Perfect.
I will take dds. :) :P
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:
>
> > 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
> >
> >
> >
> >
> >
> > _______________________________________________
> > osg-users mailing list
> >
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=67643#67643
Reply all
Reply to author
Forward
0 new messages