[Scummvm-git-logs] scummvm branch-2-8 -> 1df4e92d29d52f8b2febc0a76c39e4deb4a07199
lephilousophe
noreply at scummvm.org
Sat Feb 24 15:49:18 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1df4e92d29 BACKENDS: OPENGL: Don't take the alpha channel from the game texture
Commit: 1df4e92d29d52f8b2febc0a76c39e4deb4a07199
https://github.com/scummvm/scummvm/commit/1df4e92d29d52f8b2febc0a76c39e4deb4a07199
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2024-02-24T16:48:39+01:00
Commit Message:
BACKENDS: OPENGL: Don't take the alpha channel from the game texture
It's not always set correctly by engines (AGS) and a fill call to clear
the screen will set it to 0 along with the other components.
Setting the framebuffer to some transparent value is not something we
intend to do as this let the content underneath the drawing texture
visible like it's the case on ChromeOS.
This has been reported here: https://forums.scummvm.org/viewtopic.php?p=99293
Changed paths:
backends/graphics/opengl/framebuffer.cpp
backends/graphics/opengl/framebuffer.h
backends/graphics/opengl/opengl-graphics.cpp
diff --git a/backends/graphics/opengl/framebuffer.cpp b/backends/graphics/opengl/framebuffer.cpp
index c74ee60ef79..d6b69079f76 100644
--- a/backends/graphics/opengl/framebuffer.cpp
+++ b/backends/graphics/opengl/framebuffer.cpp
@@ -111,6 +111,11 @@ void Framebuffer::applyBlendState() {
case kBlendModeDisabled:
GL_CALL(glDisable(GL_BLEND));
break;
+ case kBlendModeOpaque:
+ GL_CALL(glEnable(GL_BLEND));
+ GL_CALL(glBlendColor(1.f, 1.f, 1.f, 0.f));
+ GL_CALL(glBlendFunc(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR));
+ break;
case kBlendModeTraditionalTransparency:
GL_CALL(glEnable(GL_BLEND));
GL_CALL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
diff --git a/backends/graphics/opengl/framebuffer.h b/backends/graphics/opengl/framebuffer.h
index a38663107b1..406a6f983a0 100644
--- a/backends/graphics/opengl/framebuffer.h
+++ b/backends/graphics/opengl/framebuffer.h
@@ -42,10 +42,16 @@ public:
enum BlendMode {
/**
* Newly drawn pixels overwrite the existing contents of the framebuffer
- * without mixing with them
+ * without mixing with them.
*/
kBlendModeDisabled,
+ /**
+ * Newly drawn pixels overwrite the existing contents of the framebuffer
+ * without mixing with them. Alpha channel is discarded.
+ */
+ kBlendModeOpaque,
+
/**
* Newly drawn pixels mix with the framebuffer based on their alpha value
* for transparency.
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index e35eebfd41a..44d30b936aa 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -700,7 +700,7 @@ void OpenGLGraphicsManager::updateScreen() {
bool drawCursor = _cursorVisible && _cursor;
// Alpha blending is disabled when drawing the screen
- _targetBuffer->enableBlend(Framebuffer::kBlendModeDisabled);
+ _targetBuffer->enableBlend(Framebuffer::kBlendModeOpaque);
// First step: Draw the (virtual) game screen.
_pipeline->drawTexture(_gameScreen->getGLTexture(), _gameDrawRect.left, _gameDrawRect.top, _gameDrawRect.width(), _gameDrawRect.height());
More information about the Scummvm-git-logs
mailing list