HI Antiro,

You code looks fine, there isn't anything else you need to do to set
up filter modes.

I haven't heard of issues with setting the filter modes so would
expect it to work. Perhaps what is amiss is either something higher up
- such as the texture not being used in the subgraph that you think it
is being used - or that the filtering is working and you are just
mis-interpreting the results.

Robert.

On 12 February 2018 at 07:51, antiro black <antir...@gmail.com> wrote:
> Hi,
>
> I'm trying to use a texture to get some data to a shader. The texure is 
> created by first creating an osg::Image, setting its pixel values manually 
> and then assigning the image to a texture. I have verified that the image is 
> created correctly by writing it to a file.
>
> As for the actual texture generation I use the following code:
>
>
> Code:
>
> osg::ref_ptr<osg::Image> m_tileDataImg=nullptr;
>
> // some code to create the osg::image
> // ...
> // ...
>
> auto tileDataTexture=new osg::Texture2D();
>
> tileDataTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::REPEAT);
> tileDataTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::REPEAT);
> tileDataTexture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::NEAREST);
> tileDataTexture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::NEAREST);
> tileDataTexture->setImage(m_tileDataImg);
>
> drawableNode->getStateSet()->setTextureAttributeAndModes(0,tileDataTexture,osg::StateAttribute::ON);
>
>
>
>
>
> In my shader I rendered the texture for debugging purposes and realized that 
> the data was changed. After a closer inspection it turned out that the data 
> had been interpolated, hence my suspicion that the "setFilter" code did not 
> work correctly.
>
> My question is whether there is some other thing I need to do to ensure that 
> no interpolation happens when sampling the texture in my shader?
>
> Any help would be greatly appreciated.
> Thank you!
>
> Cheers,
> antiro
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=72956#72956
>
>
>
>
>
> _______________________________________________
> 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

Reply via email to