Hi,Pawel

Thank you so much for the two more important things. But for the first one, I 
cannot understand it and try it by the follow way, but when use the second 
texture to bind the same image unit, and use dirty the parameters, the second 
texture don't work. 

The code: first call exeRowConvolution, then call the exeColumnConvolution. 
[code]
void exeRowConvolution( osg::ref_ptr<osg::Node> vNode, const std::string& 
vFileName ) 
{ 
   if ( !vNode ) vNode = new osg::Node; 
   vNode->setDataVariance( osg::Object::DYNAMIC ); 
   osg::ref_ptr<osg::StateSet> pStateSetTemp = vNode->getOrCreateStateSet(); 

   osg::ref_ptr<osg::Program> pComputeProg = 
createCSProgram(NumWorkGroup(DIM_MAP / 32,  DIM_MAP / 32, 1), vFileName); 
   pStateSetTemp->setAttributeAndModes( pComputeProg.get() ); 
    g_HeightTex->bindToImageUnit(0, osg::Texture::READ_WRITE); 
    pStateSetTemp->setTextureAttribute(0, g_HeightTex.get()); 
    pStateSetTemp->addUniform( new osg::Uniform("uSourceData", 
(int)g_HeightTex->getImageAttachment().unit) ); 

   g_ConvolutionTempTex->bindToImageUnit(1, osg::Texture::READ_WRITE); 
   pStateSetTemp->setTextureAttribute(1, g_ConvolutionTempTex.get()); 
   pStateSetTemp->addUniform( new osg::Uniform("uTargetData", 
(int)g_ConvolutionTempTex->getImageAttachment().unit) ); 
... 
} 

void exeColumnConvolution( osg::ref_ptr<osg::Node> vNode, const std::string& 
vFileName ) 
{ 
   if ( !vNode ) vNode = new osg::Node; 
   vNode->setDataVariance( osg::Object::DYNAMIC ); 
   osg::ref_ptr<osg::StateSet> pStateSetTemp = vNode->getOrCreateStateSet(); 

   osg::ref_ptr<osg::Program> pComputeProg = 
createCSProgram(NumWorkGroup(DIM_MAP / 32,  DIM_MAP / 32, 1), vFileName); 
   pStateSetTemp->setAttributeAndModes( pComputeProg.get() ); 
    
   g_ConvolutionTempTex->bindToImageUnit(0, osg::Texture::READ_WRITE); 
   g_ConvolutionTempTex->dirtyTextureParameters(); 
   pStateSetTemp->setTextureAttribute(0, g_ConvolutionTempTex.get()); 
   pStateSetTemp->addUniform( new osg::Uniform("uSourceData", 
(int)g_ConvolutionTempTex->getImageAttachment().unit) ); 

   g_ConvolutionTex->bindToImageUnit(1, osg::Texture::READ_WRITE); 
   g_ConvolutionTex->dirtyTextureParameters(); 
   pStateSetTemp->setTextureAttribute(1, g_ConvolutionTex.get()); 
   pStateSetTemp->addUniform( new osg::Uniform("uTargetData", 
(int)g_ConvolutionTex->getImageAttachment().unit) ); 
... 
} 

Please help me, and give more details about this. 

Thank you!

Cheers,
tangyulei

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





_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to