Set the draw and read buffer to GL_NONE when using FBO's, thereby avoid

invalid enumrates being generated.
This commit is contained in:
Robert Osfield 2005-11-01 15:39:26 +00:00
parent 4509232792
commit e23176c3b6

View File

@ -205,9 +205,9 @@ void RenderStage::runCameraSetUp(osg::State& state)
osg::notify(osg::INFO)<<"Setting up osg::CameraNode::FRAME_BUFFER_OBJECT"<<std::endl; osg::notify(osg::INFO)<<"Setting up osg::CameraNode::FRAME_BUFFER_OBJECT"<<std::endl;
_fbo = new osg::FrameBufferObject; _fbo = new osg::FrameBufferObject;
setDrawBuffer(GL_BACK); setDrawBuffer(GL_NONE);
setReadBuffer(GL_BACK); setReadBuffer(GL_NONE);
bool colorAttached = false; bool colorAttached = false;
bool depthAttached = false; bool depthAttached = false;
@ -520,8 +520,6 @@ void RenderStage::drawInner(osg::State& state,RenderLeaf*& previous, bool& doCop
copyTexture(state); copyTexture(state);
} }
state.checkGLErrors("before readPixel;");
if (_image.valid()) if (_image.valid())
{ {
@ -541,6 +539,7 @@ void RenderStage::drawInner(osg::State& state,RenderLeaf*& previous, bool& doCop
_image->readPixels(_viewport->x(), _viewport->y(), _image->readPixels(_viewport->x(), _viewport->y(),
_viewport->width(), _viewport->height(), _viewport->width(), _viewport->height(),
pixelFormat, dataType); pixelFormat, dataType);
} }
@ -550,8 +549,6 @@ void RenderStage::drawInner(osg::State& state,RenderLeaf*& previous, bool& doCop
(*(_camera->getPostDrawCallback()))(*_camera); (*(_camera->getPostDrawCallback()))(*_camera);
} }
state.checkGLErrors("before glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);");
if (fbo_supported) if (fbo_supported)
{ {
// switch of the frame buffer object // switch of the frame buffer object
@ -560,9 +557,6 @@ void RenderStage::drawInner(osg::State& state,RenderLeaf*& previous, bool& doCop
doCopyTexture = true; doCopyTexture = true;
} }
state.checkGLErrors("after glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);");
if (fbo_supported && _camera) if (fbo_supported && _camera)
{ {
// now generate mipmaps if they are required. // now generate mipmaps if they are required.