[osg-users] How to render the image without reducing its size.?
Christian Buchner
christian.buchner at gmail.com
Tue Nov 22 05:06:34 PST 2016
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 <umaselvam1503 at gmail.com>:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20161122/ecb84d1f/attachment-0002.htm>
More information about the osg-users
mailing list