[osg-users] How to render the image without reducing its size.?
Robert Osfield
robert.osfield at gmail.com
Tue Nov 22 05:30:58 PST 2016
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 <umaselvam1503 at gmail.com> 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<osg::Image> image;
> image = osgDB::readImageFile("C:\\Users\\mcw\\Desktop\\DemModel.tif.gdal");
> std::cout << "Image info are " << image->s() << "\n" <<image->t() <<"\n" <<image->r() << std::endl;
> if (!(image.valid()))
> {
> std::cout << "Unable to read image file " << std::endl;
> getchar();
> return 0;
> }
>
> osg::ref_ptr<osg::Geode> 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 at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
More information about the osg-users
mailing list