diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-16 16:43:35 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-22 22:16:07 +0100 |
commit | bcd15b4dd2b40c0d15b0faa3254c18982aea16c2 (patch) | |
tree | 9e35a7e0bdb91b7af521159c7a677ba24e9331b3 /src | |
parent | 1e1a9f39994bf6b4053a423f2b064b917fee402c (diff) | |
download | openttd-bcd15b4dd2b40c0d15b0faa3254c18982aea16c2.tar.xz |
Codechange: [OpenGL] Initialize backing store to opaque alpha to allow blending effects.
Diffstat (limited to 'src')
-rw-r--r-- | src/video/opengl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index b5292b88b..3d3e435c1 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -626,6 +626,15 @@ bool OpenGLBackend::Resize(int w, int h, bool force) /* Re-allocate video buffer texture and backing store. */ _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->vid_pbo); _glBufferData(GL_PIXEL_UNPACK_BUFFER, pitch * h * bpp / 8, nullptr, GL_DYNAMIC_READ); // Buffer content has to persist from frame to frame and is read back by the blitter, which means a READ usage hint. + if (bpp == 32) { + /* Initialize backing store alpha to opaque for 32bpp modes. */ + Colour black(0, 0, 0); + uint32 *buf = (uint32 *)_glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_READ_WRITE); + for (int i = 0; i < pitch * h; i++) { + *buf++ = black.data; + } + _glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + } _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); _glActiveTexture(GL_TEXTURE0); |