Fixes to RenderToTextureStage to account for the cull/draw traversal no longer using

reference counting of statesets.

Moved last uint reference over to unsigned int.
This commit is contained in:
Robert Osfield
2003-02-15 19:51:53 +00:00
parent a07cbb969d
commit 9208e24bd4
2 changed files with 7 additions and 5 deletions

View File

@@ -28,7 +28,7 @@ void MyRenderToTextureStage::draw(osg::State& state, osgUtil::RenderLeaf*& previ
if (_pbuffer && _texture.valid())
{
// Create pbuffer texture
const osg::uint contextID = state.getContextID();
const unsigned int contextID = state.getContextID();
GLuint& handle = _texture->getTextureObject(contextID);
if (handle == 0)
{

View File

@@ -76,6 +76,8 @@ class MyCullCallback : public osg::NodeCallback
osg::ref_ptr<osg::Node> _subgraph;
osg::ref_ptr<osg::Texture2D> _texture;
osg::ref_ptr<osg::StateSet> _localState
};
@@ -133,9 +135,9 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
cv.pushModelViewMatrix(matrix);
osg::ref_ptr<osg::StateSet> dummyState = new osg::StateSet;
if (!_localState) _localState = new osg::StateSet;
cv.pushStateSet(dummyState.get());
cv.pushStateSet(_localState.get());
{
// traverse the subgraph
@@ -176,10 +178,10 @@ void MyCullCallback::doPreRender(osg::Node&, osgUtil::CullVisitor& cv)
osg::Viewport* new_viewport = new osg::Viewport;
// new_viewport->setViewport(center_x-width/2,center_y-height/2,width,height);
new_viewport->setViewport(0,0,width,height);
new_viewport->setViewport(0,0,width,height);
rtts->setViewport(new_viewport);
dummyState->setAttribute(new_viewport);
_localState->setAttribute(new_viewport);
// and the render to texture stage to the current stages
// dependancy list.