[osg-users] [vpb] osgdem: set texture minfilter and magfilter to nearest?

81 views
Skip to first unread message

Ethan Fahy

unread,
Mar 14, 2012, 9:22:31 AM3/14/12
to osg-...@lists.openscenegraph.org
Hello,

I've played around with the --no-interpolate-imagery and --no-mip-mapping flags to see how they are affecting the texture filters but haven't found a way to set them to NEAREST. Is this possible using a flag in osgdem? Thanks,

-Ethan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=46262#46262

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Ethan Fahy

unread,
Mar 20, 2012, 10:38:38 AM3/20/12
to osg-...@lists.openscenegraph.org
And if it's not possible, is there any way to change the filters once I've read a terrain.ive file into an osg project? I've seen this code snippet:


Code:

osg::osg::Node* terrain = osgDB::readNodeFile("terrain.ive");
osg::Texture2D* tex = new osg::Texture2D;
tex->setFilter(osg::Texture::MIN_FILTER, osg::Texture::NEAREST);
tex->setFilter(osg::Texture::MAG_FILTER, osg::Texture::NEAREST);
terrain->getOrCreateStateSet()->setTextureAttribute(0, tex.get(), osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE);


but that creates a new texture2d object that overwrites all of my other textures instead of just changing the filter type. Any advice on this?

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=46441#46441

Robert Osfield

unread,
Mar 20, 2012, 12:19:08 PM3/20/12
to osg-...@lists.openscenegraph.org
HI Ethan,

Texture filter is controlled per osg::Texture, you can't override the
filtering without overriding a the texturing.

If you want to modify the filtering of the textures that an osgTerrain
based database they you'll need to load the scene graph then search
the scene graph to locate the TerrainTile, from these you can get the
color layers, and each of these layer with have the MinFilter and
MagFilter.

Robert.

Reply all
Reply to author
Forward
0 new messages