aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp9
-rw-r--r--backends/graphics/opengl/opengl-graphics.h7
2 files changed, 10 insertions, 6 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 3321689366..925b2c5a82 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -572,7 +572,7 @@ void OpenGLGraphicsManager::setMouseCursor(const void *buf, uint w, uint h, int
} else {
textureFormat = _defaultFormatAlpha;
}
- _cursor = createTexture(textureFormat);
+ _cursor = createTexture(textureFormat, true);
assert(_cursor);
_cursor->enableLinearFiltering(_currentState.graphicsMode == GFX_LINEAR);
}
@@ -911,14 +911,15 @@ void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) {
}
}
-Texture *OpenGLGraphicsManager::createTexture(const Graphics::PixelFormat &format) {
+Texture *OpenGLGraphicsManager::createTexture(const Graphics::PixelFormat &format, bool wantAlpha) {
GLenum glIntFormat, glFormat, glType;
if (format.bytesPerPixel == 1) {
- const bool supported = getGLPixelFormat(_defaultFormat, glIntFormat, glFormat, glType);
+ const Graphics::PixelFormat &virtFormat = wantAlpha ? _defaultFormatAlpha : _defaultFormat;
+ const bool supported = getGLPixelFormat(virtFormat, glIntFormat, glFormat, glType);
if (!supported) {
return nullptr;
} else {
- return new TextureCLUT8(glIntFormat, glFormat, glType, _defaultFormat);
+ return new TextureCLUT8(glIntFormat, glFormat, glType, virtFormat);
}
} else {
const bool supported = getGLPixelFormat(format, glIntFormat, glFormat, glType);
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 5d80968089..6b13db8558 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -174,10 +174,13 @@ private:
/**
* Create a texture with the specified pixel format.
*
- * @param format The pixel format the Texture object should accept as input.
+ * @param format The pixel format the Texture object should accept as
+ * input.
+ * @param wantAlpha For CLUT8 textures this marks whether an alpha
+ * channel should be used.
* @return A pointer to the texture or nullptr on failure.
*/
- Texture *createTexture(const Graphics::PixelFormat &format);
+ Texture *createTexture(const Graphics::PixelFormat &format, bool wantAlpha = false);
//
// Transaction support