Show
Ignore:
Timestamp:
09/26/08 16:50:41 (6 years ago)
Author:
robert
Message:

Added setting of various filters and setResizeNonPowerOfTwoHint(false) on normals maps etc.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp

    r8946 r8951  
    924924        osg::Texture3D* normalMap = new osg::Texture3D; 
    925925        normalMap->setImage(normalmap_3d);     
     926        normalMap->setResizeNonPowerOfTwoHint(false); 
     927        normalMap->setInternalFormatMode(internalFormatMode); 
     928        normalMap->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); 
     929        normalMap->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); 
     930        normalMap->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE); 
     931        normalMap->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE); 
     932        normalMap->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE); 
     933 
    926934        stateset->setTextureAttributeAndModes(1,normalMap,osg::StateAttribute::ON); 
    927935 
     
    930938            osg::Texture1D* texture1D = new osg::Texture1D; 
    931939            texture1D->setImage(tf->getImage());     
     940            texture1D->setResizeNonPowerOfTwoHint(false); 
     941            texture1D->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); 
     942            texture1D->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); 
     943            texture1D->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE); 
    932944            stateset->setTextureAttributeAndModes(0,texture1D,osg::StateAttribute::ON); 
    933945 
     
    970982        osg::Texture3D* normalMap = new osg::Texture3D; 
    971983        normalMap->setImage(normalmap_3d);     
     984        normalMap->setResizeNonPowerOfTwoHint(false); 
     985        normalMap->setInternalFormatMode(internalFormatMode); 
     986        normalMap->setFilter(osg::Texture3D::MIN_FILTER, osg::Texture::LINEAR); 
     987        normalMap->setFilter(osg::Texture3D::MAG_FILTER, osg::Texture::LINEAR); 
     988        normalMap->setWrap(osg::Texture3D::WRAP_R,osg::Texture3D::CLAMP_TO_EDGE); 
     989        normalMap->setWrap(osg::Texture3D::WRAP_S,osg::Texture3D::CLAMP_TO_EDGE); 
     990        normalMap->setWrap(osg::Texture3D::WRAP_T,osg::Texture3D::CLAMP_TO_EDGE); 
     991 
    972992        stateset->setTextureAttributeAndModes(1,normalMap,osg::StateAttribute::ON); 
    973993 
     
    976996            osg::Texture1D* texture1D = new osg::Texture1D; 
    977997            texture1D->setImage(tf->getImage());     
     998            texture1D->setResizeNonPowerOfTwoHint(false); 
     999            texture1D->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); 
     1000            texture1D->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); 
     1001            texture1D->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE); 
    9781002            stateset->setTextureAttributeAndModes(0,texture1D,osg::StateAttribute::ON); 
    9791003 
     
    10101034        osg::Texture1D* texture1D = new osg::Texture1D; 
    10111035        texture1D->setImage(tf->getImage());     
     1036        texture1D->setResizeNonPowerOfTwoHint(false); 
     1037        texture1D->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR); 
     1038        texture1D->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); 
     1039        texture1D->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE); 
    10121040        stateset->setTextureAttributeAndModes(1,texture1D,osg::StateAttribute::ON); 
     1041 
     1042        osg::Uniform* tfTextureSampler = new osg::Uniform("tfTexture",1); 
     1043        stateset->addUniform(tfTextureSampler); 
    10131044 
    10141045        osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "volume-tf.frag"); 
     
    10221053            program->addShader(new osg::Shader(osg::Shader::FRAGMENT, volume_tf_frag)); 
    10231054        } 
    1024  
    1025         osg::Uniform* tfTextureSampler = new osg::Uniform("tfTexture",1); 
    1026         stateset->addUniform(tfTextureSampler); 
    10271055 
    10281056    }