From 99279fbf61767bf4c4175dc86bd97fc918c6ea68 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 8 Jul 2005 14:46:13 +0000 Subject: [PATCH] From Marco Jez, added missing method implementations to CameraNode and added check to ensure FBO extension is support to RenderToTextureStage. --- include/osg/CameraNode | 4 ++-- src/osgUtil/RenderToTextureStage.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/osg/CameraNode b/include/osg/CameraNode index 33f870d1e..e1e4eac66 100644 --- a/include/osg/CameraNode +++ b/include/osg/CameraNode @@ -193,10 +193,10 @@ class OSG_EXPORT CameraNode : public Transform, public CullSettings /** Set the draw buffer for a given fragment output position to specified draw buffer. */ - void setDrawBuffer(unsigned int pos, GLenum buffer); + void setDrawBuffer(unsigned int pos, GLenum buffer) { _drawBufferList[pos] = buffer; } /** Get the draw buffer for a given fragment output position. */ - GLenum getDrawBuffer(unsigned int pos); + GLenum getDrawBuffer(unsigned int pos) const { return _drawBufferList[pos]; } typedef std::vector DrawBufferList; diff --git a/src/osgUtil/RenderToTextureStage.cpp b/src/osgUtil/RenderToTextureStage.cpp index 33a2ad3f9..5da128190 100644 --- a/src/osgUtil/RenderToTextureStage.cpp +++ b/src/osgUtil/RenderToTextureStage.cpp @@ -41,7 +41,9 @@ void RenderToTextureStage::draw(osg::State& state,RenderLeaf*& previous) //cout << "begining RTTS draw "<x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<isSupported(); + + if (fbo_supported) { _fbo->apply(state); } @@ -50,7 +52,7 @@ void RenderToTextureStage::draw(osg::State& state,RenderLeaf*& previous) RenderStage::draw(state,previous); // now copy the rendered image to attached texture. - if (_texture.valid() && !fbo_ext) + if (_texture.valid() && !fbo_supported) { //cout << " reading "<x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<readPixels(_viewport->x(),_viewport->y(),_viewport->width(),_viewport->height(),_imageReadPixelFormat,_imageReadPixelDataType); - if (fbo_ext) + if (fbo_supported) { fbo_ext->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } } +