From Marco Jez, added missing method implementations to CameraNode and

added check to ensure FBO extension is support to RenderToTextureStage.
This commit is contained in:
Robert Osfield
2005-07-08 14:46:13 +00:00
parent 0d8e38f9ee
commit 99279fbf61
2 changed files with 8 additions and 5 deletions

View File

@@ -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<GLenum> DrawBufferList;

View File

@@ -41,7 +41,9 @@ void RenderToTextureStage::draw(osg::State& state,RenderLeaf*& previous)
//cout << "begining RTTS draw "<<this<< " "<<_viewport->x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<<std::endl;
osg::FBOExtensions* fbo_ext = _fbo.valid() ? osg::FBOExtensions::instance(state.getContextID()) : 0;
if (fbo_ext)
bool fbo_supported = fbo_ext && fbo_ext->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 "<<this<< " "<<_viewport->x()<<","<< _viewport->y()<<","<< _viewport->width()<<","<< _viewport->height()<<std::endl;
@@ -60,9 +62,10 @@ void RenderToTextureStage::draw(osg::State& state,RenderLeaf*& previous)
if (_image.valid())
_image->readPixels(_viewport->x(),_viewport->y(),_viewport->width(),_viewport->height(),_imageReadPixelFormat,_imageReadPixelDataType);
if (fbo_ext)
if (fbo_supported)
{
fbo_ext->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
}
}