mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 22:20:33 +00:00
Merge branch 'readbuffer_save' into 'master'
Fix black save game screenshots under certain settings (#6543) Closes #6543 See merge request OpenMW/openmw!1546
This commit is contained in:
commit
d48f072b97
@ -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<PostProcessor*>(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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user