diff --git a/apps/openmw/mwrender/screenshotmanager.cpp b/apps/openmw/mwrender/screenshotmanager.cpp index 1973ca4025..5c3d925c9b 100644 --- a/apps/openmw/mwrender/screenshotmanager.cpp +++ b/apps/openmw/mwrender/screenshotmanager.cpp @@ -91,15 +91,18 @@ namespace MWRender int width = screenW - leftPadding*2; int height = screenH - topPadding*2; - // Ensure we are reading from the resolved framebuffer and not the multisampled render buffer when in use. - // glReadPixel() cannot read from multisampled targets. + // Ensure we are reading from the resolved framebuffer and not the multisampled render buffer. Also ensure that the readbuffer is set correctly with rendeirng to FBO. + // glReadPixel() cannot read from multisampled targets PostProcessor* postProcessor = dynamic_cast(renderInfo.getCurrentCamera()->getUserData()); - if (postProcessor && postProcessor->getFbo() && postProcessor->getMsaaFbo()) + if (postProcessor && postProcessor->getFbo()) { osg::GLExtensions* ext = osg::GLExtensions::Get(renderInfo.getContextID(), false); if (ext) + { ext->glBindFramebuffer(GL_FRAMEBUFFER_EXT, postProcessor->getFbo()->getHandle(renderInfo.getContextID())); + renderInfo.getState()->glReadBuffer(GL_COLOR_ATTACHMENT0_EXT); + } } mImage->readPixels(leftPadding, topPadding, width, height, GL_RGB, GL_UNSIGNED_BYTE);