Figured out how to solve the problem in the last post. I just set the texture I
want to write on the camera itself so that its active once the post draw is
executed. For instance, the code above simply changes to the following.
Code:
...
camera->getOrCreateStateSet()->setTextureAttributeAndModes(1, outputTexture,
osg::StateAttribute::ON);
camera->setFinalDrawCallback( new Capture("output.tiff") );
geode->getOrCreateStateSet()->setTextureAttributeAndModes(1, sampler,
osg::StateAttribute::ON);
geode->getOrCreateStateSet()->addUniform( new osg::Uniform("sampler", 1) );
camera->attach(osg::Camera::COLOR_BUFFER0, outputTexture);
geode->getOrCreateStateSet()->setAttributeAndModes( prog,
osg::StateAttribute::ON );
viewer.frame();
geode->getOrCreateStateSet()->removeAttribute( prog );
Thanks for pointing me in the right direction. I can get my 3d textures written
out now!
Thanks,
Trystan
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43854#43854
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org