[osg-users] problem setting texture min/mag filter

antiro black antiro42 at gmail.com
Sun Feb 11 23:51:50 PST 2018


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:


osg::ref_ptr<osg::Image> m_tileDataImg=nullptr;

// some code to create the osg::image
// ...
// ...

auto tileDataTexture=new osg::Texture2D();

tileDataTexture->setFilter(osg::Texture::MIN_FILTER, osg::Texture::NEAREST);
tileDataTexture->setFilter(osg::Texture::MAG_FILTER, osg::Texture::NEAREST);


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!


Read this topic online here:

More information about the osg-users mailing list