[osg-users] Optimizing texture power of two resizing

Chris Kuliukas chris at kuliukas.com
Wed Dec 16 23:48:24 PST 2015


By the way while I have your attention is this how you would do a visitor to access all images?


Code:

void ImageResizeVisitor::apply(osg::Node& node)
{
	osg::StateSet* ss = node.getStateSet();
	if ( ss )
	{
		osg::StateAttribute* sa = ss->getAttribute(osg::StateAttribute::TEXTURE); 
		for( int j = 0; j < ss->getNumTextureAttributeLists(); j++ )
		{
			osg::Texture2D* tex =  dynamic_cast<osg::Texture2D*>( ss->getTextureAttribute(j, osg::StateAttribute::TEXTURE) );
			if( tex )
			{
				for(int i = 0; i < tex->getNumImages(); i++)
				{
					osg::Image* im = tex->getImage(i);




It works but took quite a while to tease the images out.

------------------------
http://www.hrwallingford.com/facilities/ship-simulation-centre (http://www.hrwallingford.com/facilities/ship-simulation-centre)

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








More information about the osg-users mailing list