I think I found the osg plugin to decompress PVR but I don't know how to use it.
Do you have any idea? Alistair Baxter wrote: > PVRTC is exclusive to Imagination technology’s PowerVR chipsets. All iDevices > use those chipsets, so it’s in common use on iOS, but only certain Android > devices with the right type of GPU support it. > > I don’t believe there are any desktop or laptop graphics cards that support > it directly, but there’s a library available to decompress them. > > Alistair Baxter > Software Engineer > ________________________________ > Have you downloaded your FREE copy of FieldMove Clino? > Find out more about our app for iPhone and Android smartphones: > http://news.mve.com/fieldmoveclino (http://news.mve.com/fieldmoveclino) > Midland Valley Exploration Ltd. > 144 West George Street > Glasgow G2 2HG > United Kingdom > Tel: +44 (0) 141 332 2681 > Fax: +44 (0) 141 332 6792 > The structural geology experts > > From: [mailto:] On Behalf Of Glenn Waldron > Sent: 19 November 2013 15:32 > To: OpenSceneGraph Users > Subject: Re: Optimizing memory usage by Texture of size 4096x2048 > > It stays compressed in memory (CPU and GPU), so you get 4:1 compression in > the app, not just on disk. > > > No experience with PVR; is it Apple only? > > > > > > Glenn Waldron / @glennwaldron > > > On Tue, Nov 19, 2013 at 10:25 AM, John Moore < ()> wrote: > I am not very concerned about disk usage. I am more concerned about RAM. Will > be there any advantages using this kind of compression? If yes how can I > compress and then load the data in a osg::Image? > > I am asking because I tried to do the compression with PVR (using > PVRTexToolGUI) but I was not able to load it in a osg::Image. > > Thank you. > > John > > > gwaldron wrote: > > > Your only further recourse would be to take Luc's advice and DXT-compress > > the data on disk (using NVTT e.g.); that will give you 4:1 savings. > > > > Ref: > > > > > > http://en.wikipedia.org/wiki/S3_Texture_Compression#S3TC_Format_Comparison > > (http://en.wikipedia.org/wiki/S3_Texture_Compression#S3TC_Format_Comparison) > > > > (http://en.wikipedia.org/wiki/S3_Texture_Compression#S3TC_Format_Comparison > > (http://en.wikipedia.org/wiki/S3_Texture_Compression#S3TC_Format_Comparison)) > > > > > > > > Glenn Waldron / @glennwaldron > > > > > > On Tue, Nov 19, 2013 at 9:51 AM, John Moore < ()> wrote: > > > > > > > Memory usage is for the entire app. > > > However memory usage of the same scene if I don’t load the texture is 20 > > > MB. So I can safely assume the rest is consumed by the fact the textures > > > are applied to the sphere. > > > > > > > > > gwaldron wrote: > > > > > > > > > > 110MB -- CPU or GPU memory? For the entire app or just your textures? > > > > > > > > Quick math: > > > > 2 * 4096 * 2048 * 4 * 1.3 = 87MB. > > > > (4 = RGBA, 1.3 = mipmaps) > > > > > > > > > > > > > > > > > > > > > > > > Glenn Waldron / @glennwaldron > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Nov 19, 2013 at 9:18 AM, John Moore < ()> wrote: > > > > > > > > > > > > > > > > > Thank you Gwaldron, > > > > > that line of code saved me 40MB. Better than nothing. Now the memory > > > > > usage is around 110 MB. > > > > > > > > > > The format of the image is JPG. > > > > > I tried to use PVR but I can't load the image. > > > > > > > > > > This is the complete function (updated with your suggestion) that I > > > > > use to create a sphere with 2 textures. > > > > > Then I use a shader to cross fade between the two textures.... that's > > > > > why I need to have both of them in memory. > > > > > > > > > > > > > > > Code: > > > > > > > > > > - (osg::ref_ptr<osg::Geode>)createSphereWithTodayImage:(NSString > > > > > *)todayTextName pastImage:(NSString *)pastTextName andRay:(CGFloat)ray > > > > > { > > > > > osg::ref_ptr<osg::Geode> sphere = new osg::Geode(); > > > > > sphere->addDrawable(new osg::ShapeDrawable(new > > > > > osg::Sphere(osg::Vec3(), ray))); > > > > > sphere->setName("BubbleNode"); > > > > > > > > > > // load image for texture > > > > > osg::ref_ptr<osg::Image> todayImage = > > > > > osgDB::readImageFile(todayTextName.UTF8String); > > > > > osg::ref_ptr<osg::Image> pastImage = > > > > > osgDB::readImageFile(pastTextName.UTF8String); > > > > > > > > > > if (!todayImage || !pastImage) > > > > > { > > > > > std::cout << "Couldn't load texture." << std::endl; > > > > > } > > > > > else > > > > > { > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D; > > > > > texture->setDataVariance(osg::Object::STATIC); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); > > > > > texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); > > > > > texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP); > > > > > texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > texture->setImage(todayImage.release()); > > > > > texture->setUnRefImageDataAfterApply(true); > > > > > sphere->getOrCreateStateSet()->setTextureAttributeAndModes(0,texture.get()); > > > > > > > > > > osg::ref_ptr<osg::Texture2D> texture2 = new osg::Texture2D; > > > > > texture2->setDataVariance(osg::Object::STATIC); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > texture2->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); > > > > > texture2->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); > > > > > texture2->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP); > > > > > texture2->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > texture2->setImage(pastImage.release()); > > > > > texture->setUnRefImageDataAfterApply(true); > > > > > sphere->getOrCreateStateSet()->setTextureAttributeAndModes(1,texture2.get()); > > > > > > > > > > } > > > > > return sphere; > > > > > } > > > > > > > > > > > > > > > > > > > > and then I call this to add the sphere > > > > > > > > > > Code: > > > > > > > > > > osg::ref_ptr<osg::Geode> sphere = [self > > > > > createSphereWithTodayImage:"pathofimage1.jpg" > > > > > pastImage:"pathofimage2.jpg" andRay:1.0f]; > > > > > _root->addChild(sphere.get()); > > > > > _root->setDataVariance( osg::Object::DYNAMIC); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > gwaldron wrote: > > > > > > > > > > > > > > > > > > > > > What's the data type of your image? Show the code where you > > > > > > allocate the image data. > > > > > > > > > > > > You can also call this, which will free the CPU memory once the > > > > > > texture gets to the GPU: > > > > > > > > > > > > texture->setUnRefImageDataAfterApply(true); > > > > > > > > > > > > > > > > > > Glenn Waldron / @glennwaldron > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Nov 19, 2013 at 8:11 AM, John Moore < ()> wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi, > > > > > > > > > > > > > > In my app I am using 2 textures of size 4096x2048. > > > > > > > I have a serious problem of memory usage. > > > > > > > > > > > > > > > > > > > > > Code: > > > > > > > > > > > > > > osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D; > > > > > > > texture->setDataVariance(osg::Object::STATIC); > > > > > > > texture->setFilter(osg::Texture::MIN_FILTER, > > > > > > > osg::Texture::LINEAR_MIPMAP_LINEAR); > > > > > > > texture->setFilter(osg::Texture::MAG_FILTER, > > > > > > > osg::Texture::LINEAR); > > > > > > > texture->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP); > > > > > > > texture->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP); > > > > > > > texture->setImage(image.release()); > > > > > > > sphere->getOrCreateStateSet()->setTextureAttributeAndModes(0,texture.get()); > > > > > > > > > > > > > > osg::ref_ptr<osg::Texture2D> texture2 = new osg::Texture2D; > > > > > > > texture2->setDataVariance(osg::Object::STATIC); > > > > > > > texture2->setFilter(osg::Texture::MIN_FILTER, > > > > > > > osg::Texture::LINEAR_MIPMAP_LINEAR); > > > > > > > texture2->setFilter(osg::Texture::MAG_FILTER, osg::Texture:: > > > > > > > LINEAR); > > > > > > > texture2->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP); > > > > > > > texture2->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP); > > > > > > > texture2->setImage(image2.release()); > > > > > > > sphere->getOrCreateStateSet()->setTextureAttributeAndModes(1,texture2.get()); > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > using this code my app jumps from 20 MB of memory to 250 MB of > > > > > > > memory usage > > > > > > > > > > > > > > Since I am developing on mobile platform this is a huge waste of > > > > > > > memory. > > > > > > > > > > > > > > I partially solved the problem by changing the MIN_FILTER from > > > > > > > LINEAR_MIPMAP_LINEAR to LINEAR > > > > > > > Now the memory usage is 150MB > > > > > > > > > > > > > > It's still a lot! > > > > > > > > > > > > > > Do you know a way to optimize the memory usage of these 2 > > > > > > > textures? > > > > > > > > > > > > > > Thank you, > > > > > > > Have a nice day (or night :) ), > > > > > > > > > > > > > > John > > > > > > > > > > > > > > ------------------ > > > > > > > Read this topic online here: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://forum.openscenegraph.org/viewtopic.php?p=57295#57295 > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295 > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295)) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295 > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295 > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295))) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295 > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295 > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295)) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295 > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57295#57295) > > > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=5 7295#57295)))) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > osg-users mailing list > > > > > > > () > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)) > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org))) > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)) > > > > > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegr aph.org (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)))) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------ > > > > > Read this topic online here: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://forum.openscenegraph.org/viewtopic.php?p=57300#57300 > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57300#57300) > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57300#57300 > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57300#57300)) > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57300#57300 > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57300#57300) > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57300#57300 > > > > > (http://forum.openscenegraph.org/viewtopic.php?p=57300#57300))) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > osg-users mailing list > > > > > () > > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)) > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org))) > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > ------------------ > > > Read this topic online here: > > > > > > > > > > > > > > > http://forum.openscenegraph.org/viewtopic.php?p=57306#57306 > > > (http://forum.openscenegraph.org/viewtopic.php?p=57306#57306) > > > (http://forum.openscenegraph.org/viewtopic.php?p=57306#57306 > > > (http://forum.openscenegraph.org/viewtopic.php?p=57306#57306)) > > > > > > > > > > > > > > > > > > _______________________________________________ > > > osg-users mailing list > > > () > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org) > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)) > > > > > > > > > > > > > > > > > > > > > > ------------------ > Read this topic online here: > > http://forum.openscenegraph.org/viewtopic.php?p=57311#57311 > (http://forum.openscenegraph.org/viewtopic.php?p=57311#57311) > > > > > > _______________________________________________ > osg-users mailing list > () > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > (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=57316#57316 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org