Skip to content

Commit fb1ae45

Browse files
committed
GL: fix framebuffer attachment not being cleared
1 parent c9fef8c commit fb1ae45

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/renderer/backend/opengl/RenderTargetGL.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,15 @@ void RenderTargetGL::update() const {
5050
GLenum bufs[MAX_COLOR_ATTCHMENT] = {GL_NONE};
5151
for (size_t i = 0; i < MAX_COLOR_ATTCHMENT; ++i)
5252
{
53+
GLuint texture = 0;
54+
GLint level = 0;
5355
if (_color[i])
5456
{
55-
auto textureInfo = _color[i];
56-
auto textureHandler = static_cast<GLuint>(textureInfo.texture != nullptr ? textureInfo.texture->getHandler() : 0);
57-
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, textureHandler,
58-
textureInfo.level);
57+
texture = static_cast<GLuint>(_color[i].texture->getHandler());
58+
level = _color[i].level;
5959
bufs[i] = GL_COLOR_ATTACHMENT0 + i;
6060
}
61+
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, texture, level);
6162
}
6263
#if AX_TARGET_PLATFORM == AX_PLATFORM_WIN32 || AX_TARGET_PLATFORM == AX_PLATFORM_LINUX
6364
glDrawBuffers(MAX_COLOR_ATTCHMENT, bufs);

0 commit comments

Comments
 (0)