Changeset 8953 for OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
- Timestamp:
- 09/28/08 17:16:13 (5 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgvolume/osgvolume.cpp
r8952 r8953 922 922 else if (shadingModel==Isosurface) 923 923 { 924 osg::Uniform* normalMapSampler = new osg::Uniform("normalMap",1);925 stateset->addUniform(normalMapSampler);926 927 osg::Texture3D* normalMap = new osg::Texture3D;928 normalMap->setImage(normalmap_3d);929 normalMap->setResizeNonPowerOfTwoHint(false);930 normalMap->setInternalFormatMode(internalFormatMode);931 normalMap->setFilter(osg::Texture::MIN_FILTER, osg::Texture::LINEAR);932 normalMap->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR);933 normalMap->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE);934 normalMap->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE);935 normalMap->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE);936 937 stateset->setTextureAttributeAndModes(1,normalMap,osg::StateAttribute::ON);938 924 939 925 if (tf) … … 945 931 texture1D->setFilter(osg::Texture::MAG_FILTER, osg::Texture::LINEAR); 946 932 texture1D->setWrap(osg::Texture::WRAP_R,osg::Texture::CLAMP_TO_EDGE); 947 stateset->setTextureAttributeAndModes(0,texture1D,osg::StateAttribute::ON); 933 stateset->setTextureAttributeAndModes(1,texture1D,osg::StateAttribute::ON); 934 935 osg::Uniform* tfTextureSampler = new osg::Uniform("tfTexture",1); 936 stateset->addUniform(tfTextureSampler); 948 937 949 938 osg::Shader* fragmentShader = osgDB::readShaderFile(osg::Shader::FRAGMENT, "volume_tf_iso.frag"); … … 957 946 program->addShader(new osg::Shader(osg::Shader::FRAGMENT, volume_tf_iso_frag)); 958 947 } 959 960 osg::Uniform* tfTextureSampler = new osg::Uniform("tfTexture",0);961 stateset->addUniform(tfTextureSampler);962 963 948 } 964 949 else … … 1770 1755 arguments.getApplicationUsage()->addCommandLineOption("-s <numSlices>","Number of slices to create."); 1771 1756 arguments.getApplicationUsage()->addCommandLineOption("--images [filenames]","Specify a stack of 2d images to build the 3d volume from."); 1772 arguments.getApplicationUsage()->addCommandLineOption("--shader","Use OpenGL Shading Language."); 1757 arguments.getApplicationUsage()->addCommandLineOption("--shader","Use OpenGL Shading Language. (default)"); 1758 arguments.getApplicationUsage()->addCommandLineOption("--no-shader","Disable use of OpenGL Shading Language."); 1759 arguments.getApplicationUsage()->addCommandLineOption("--gpu-tf","Aply the transfer function on the GPU. (default)"); 1760 arguments.getApplicationUsage()->addCommandLineOption("--cpu-tf","Apply the transfer function on the CPU."); 1773 1761 arguments.getApplicationUsage()->addCommandLineOption("--mip","Use Maximum Intensity Projection (MIP) filtering."); 1774 1762 arguments.getApplicationUsage()->addCommandLineOption("--xSize <size>","Relative width of rendered brick."); … … 1850 1838 { 1851 1839 shadingModel = Isosurface; 1852 createNormalMap=true;1853 1840 } 1854 1841 … … 1902 1889 while(arguments.read("--num-components", numComponentsDesired)) {} 1903 1890 1904 bool useShader = false;1891 bool useShader = true; 1905 1892 while(arguments.read("--shader")) { useShader = true; } 1906 1907 bool gpuTransferFunction = false; 1893 while(arguments.read("--no-shader")) { useShader = true; } 1894 1895 bool gpuTransferFunction = true; 1908 1896 while(arguments.read("--gpu-tf")) { gpuTransferFunction = true; } 1897 while(arguments.read("--cpu-tf")) { gpuTransferFunction = false; } 1909 1898 1910 1899 osg::ref_ptr<osg::Image> image_3d;
