mirror of https://github.com/axmolengine/axmol.git
set gl framebuffer read and write back again (#20403)
* set gl framebuffer read and write back again * update review
This commit is contained in:
parent
ed1e0744c4
commit
3541d06339
|
@ -198,6 +198,23 @@ void CommandBufferGL::applyRenderPassDescriptor(const RenderPassDescriptor& desc
|
|||
|
||||
if (useGeneratedFBO)
|
||||
_generatedFBOBindColor = true;
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||
if (_framebufferReadWriteDisabled)
|
||||
{
|
||||
if (useGeneratedFBO) //user-defined framebuffer
|
||||
{
|
||||
glDrawBuffer(GL_COLOR_ATTACHMENT0);
|
||||
glReadBuffer(GL_COLOR_ATTACHMENT0);
|
||||
}
|
||||
else //default framebuffer
|
||||
{
|
||||
glDrawBuffer(GL_BACK);
|
||||
glReadBuffer(GL_BACK);
|
||||
}
|
||||
_framebufferReadWriteDisabled = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -219,6 +236,7 @@ void CommandBufferGL::applyRenderPassDescriptor(const RenderPassDescriptor& desc
|
|||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||
glDrawBuffer(GL_NONE);
|
||||
glReadBuffer(GL_NONE);
|
||||
_framebufferReadWriteDisabled = true;
|
||||
#endif
|
||||
}
|
||||
CHECK_GL_ERROR_DEBUG();
|
||||
|
|
|
@ -190,6 +190,9 @@ private:
|
|||
bool _generatedFBOBindColor = false;
|
||||
bool _generatedFBOBindDepth = false;
|
||||
bool _generatedFBOBindStencil = false;
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||
bool _framebufferReadWriteDisabled = false;
|
||||
#endif
|
||||
|
||||
GLint _defaultFBO = 0; // The value gets from glGetIntegerv, so need to use GLint
|
||||
GLuint _currentFBO = 0;
|
||||
|
|
Loading…
Reference in New Issue