Re: [osg-users] How to render the image without reducing its size.?
You should split your image in tiles! 2016-11-22 14:23 GMT+00:00 Uma Devi Selvaraj : > Hi, > >Thank you all for the reply. > ... > > Thank you! > > Cheers, > Uma > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=69474#69474 > > > > > > ___ > 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 render the image without reducing its size.?
Hi, Thank you all for the reply. ... Thank you! Cheers, Uma -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69474#69474 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to render the image without reducing its size.?
Hi Uma, Given you are using texture->setResizeNonPowerOfTwoHint(false); there isn't any need to try TextureRectangle. Given the resize of the largest axis to 4096 it's very likely that you are hitting up against the driver/hardwares maximum texture size. There is nothing you can do to increase this beyond upgrading your hardware. The OSG_MAX_TEXTURE_SIZE env var setting only clamps the maximum texture size is this value is lower than the max texture size reported by the driver so won't help you. Robert. On 22 November 2016 at 12:58, Uma Devi Selvaraj wrote: > Hi, > >I have simple code that renders image using osgviewer. I am able to render > the image successfully with the code. My problem now is the size of the image > is reduced. for example the original size of the image is 4683 * 3035, the > image is reduced to 4096 * 3035. Is this expected behaviour or is there > anything I need to add in my code. I have added my code. > > > //required header files > > int main(int argc,char**argv) > { > > osg::ref_ptr image; > image = > osgDB::readImageFile("C:\\Users\\mcw\\Desktop\\DemModel.tif.gdal"); > std::cout << "Image info are " << image->s() << "\n"<<"\n" if (!(image.valid())) > { > std::cout << "Unable to read image file " << std::endl; > getchar(); > return 0; > } > > osg::ref_ptr geode =(osg::createGeodeForImage(image)); > > osg::Texture2D *texture = new osg::Texture2D(); > texture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); > texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); > texture->setWrap(osg::Texture::WRAP_R, osg::Texture::REPEAT); > texture->setResizeNonPowerOfTwoHint(false); > texture->setImage(image); > texture->setBorderColor(osg::Vec4d(0.4f, 0.5f, 0.6f, 1.0f)); > osg::StateSet* stateset = new osg::StateSet; > > stateset->setTextureAttributeAndModes(0, texture, > osg::StateAttribute::ON); > > geode->setStateSet(stateset); > osgViewer::Viewer viewer; > viewer.setSceneData(geode.get()); > getchar(); > return viewer.run(); > > } > > ... > > Thank you! > > Cheers, > Uma > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=69470#69470 > > > > > > ___ > 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 render the image without reducing its size.?
Hi Uma, you can use TextureRectangle instead of Texture2D. Then your UV mapping is in the range of s:0-imageWidth, t:0-imageHeight and the image will preserve its original size On Tue, Nov 22, 2016 at 2:06 PM, Christian Buchner < christian.buch...@gmail.com> wrote: > > Your OpenGL implementation might signal a maximum texture size of 4096. > > Which is why there is no alternative to downsizing it. > > There is also an OSG_MAX_TEXTURE_SIZE environment variable. I am not sure > what its default value is, or if it has a default at all. Have you tried > forcing this to 8192? > > Christian > > > > 2016-11-22 13:58 GMT+01:00 Uma Devi Selvaraj : > >> Hi, >> >>I have simple code that renders image using osgviewer. I am able to >> render the image successfully with the code. My problem now is the size of >> the image is reduced. for example the original size of the image is 4683 * >> 3035, the image is reduced to 4096 * 3035. Is this expected behaviour or is >> there anything I need to add in my code. I have added my code. >> >> >> //required header files >> >> int main(int argc,char**argv) >> { >> >> osg::ref_ptr image; >> image = osgDB::readImageFile("C:\\Users\\mcw\\Desktop\\DemModel.tif. >> gdal"); >> std::cout << "Image info are " << image->s() << "\n"> <<"\n" > if (!(image.valid())) >> { >> std::cout << "Unable to read image file " << std::endl; >> getchar(); >> return 0; >> } >> >> osg::ref_ptr geode =(osg::createGeodeForImage(ima >> ge)); >> >> osg::Texture2D *texture = new osg::Texture2D(); >> texture->setFilter(osg::Texture::MIN_FILTER, >> osg::Texture::LINEAR); >> texture->setFilter(osg::Texture::MAG_FILTER, >> osg::Texture::LINEAR); >> texture->setWrap(osg::Texture::WRAP_R, osg::Texture::REPEAT); >> texture->setResizeNonPowerOfTwoHint(false); >> texture->setImage(image); >> texture->setBorderColor(osg::Vec4d(0.4f, 0.5f, 0.6f, 1.0f)); >> osg::StateSet* stateset = new osg::StateSet; >> >> stateset->setTextureAttributeAndModes(0, texture, >> osg::StateAttribute::ON); >> >> geode->setStateSet(stateset); >> osgViewer::Viewer viewer; >> viewer.setSceneData(geode.get()); >> getchar(); >> return viewer.run(); >> >> } >> >> ... >> >> Thank you! >> >> Cheers, >> Uma >> >> -- >> Read this topic online here: >> http://forum.openscenegraph.org/viewtopic.php?p=69470#69470 >> >> >> >> >> >> ___ >> 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 > > -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to render the image without reducing its size.?
Your OpenGL implementation might signal a maximum texture size of 4096. Which is why there is no alternative to downsizing it. There is also an OSG_MAX_TEXTURE_SIZE environment variable. I am not sure what its default value is, or if it has a default at all. Have you tried forcing this to 8192? Christian 2016-11-22 13:58 GMT+01:00 Uma Devi Selvaraj : > Hi, > >I have simple code that renders image using osgviewer. I am able to > render the image successfully with the code. My problem now is the size of > the image is reduced. for example the original size of the image is 4683 * > 3035, the image is reduced to 4096 * 3035. Is this expected behaviour or is > there anything I need to add in my code. I have added my code. > > > //required header files > > int main(int argc,char**argv) > { > > osg::ref_ptr image; > image = osgDB::readImageFile("C:\\Users\\mcw\\Desktop\\DemModel. > tif.gdal"); > std::cout << "Image info are " << image->s() << "\n"<<"\n" if (!(image.valid())) > { > std::cout << "Unable to read image file " << std::endl; > getchar(); > return 0; > } > > osg::ref_ptr geode =(osg::createGeodeForImage(image)); > > osg::Texture2D *texture = new osg::Texture2D(); > texture->setFilter(osg::Texture::MIN_FILTER, > osg::Texture::LINEAR); > texture->setFilter(osg::Texture::MAG_FILTER, > osg::Texture::LINEAR); > texture->setWrap(osg::Texture::WRAP_R, osg::Texture::REPEAT); > texture->setResizeNonPowerOfTwoHint(false); > texture->setImage(image); > texture->setBorderColor(osg::Vec4d(0.4f, 0.5f, 0.6f, 1.0f)); > osg::StateSet* stateset = new osg::StateSet; > > stateset->setTextureAttributeAndModes(0, texture, > osg::StateAttribute::ON); > > geode->setStateSet(stateset); > osgViewer::Viewer viewer; > viewer.setSceneData(geode.get()); > getchar(); > return viewer.run(); > > } > > ... > > Thank you! > > Cheers, > Uma > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=69470#69470 > > > > > > ___ > 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
[osg-users] How to render the image without reducing its size.?
Hi, I have simple code that renders image using osgviewer. I am able to render the image successfully with the code. My problem now is the size of the image is reduced. for example the original size of the image is 4683 * 3035, the image is reduced to 4096 * 3035. Is this expected behaviour or is there anything I need to add in my code. I have added my code. //required header files int main(int argc,char**argv) { osg::ref_ptr image; image = osgDB::readImageFile("C:\\Users\\mcw\\Desktop\\DemModel.tif.gdal"); std::cout << "Image info are " << image->s() << "\n"setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); texture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); texture->setWrap(osg::Texture::WRAP_R, osg::Texture::REPEAT); texture->setResizeNonPowerOfTwoHint(false); texture->setImage(image); texture->setBorderColor(osg::Vec4d(0.4f, 0.5f, 0.6f, 1.0f)); osg::StateSet* stateset = new osg::StateSet; stateset->setTextureAttributeAndModes(0, texture, osg::StateAttribute::ON); geode->setStateSet(stateset); osgViewer::Viewer viewer; viewer.setSceneData(geode.get()); getchar(); return viewer.run(); } ... Thank you! Cheers, Uma -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=69470#69470 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org