[Scummvm-git-logs] scummvm master -> 3328cdb969d875e1ffe4678b56ad1a09c688c421
bluegr
noreply at scummvm.org
Wed Jun 18 05:20:43 UTC 2025
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
ce1dd9260a WINTERMUTE: Move alpha mask handling into the renderer classes
3328cdb969 WINTERMUTE: Restore image deletion when OpenGL surfaces are invalidated
Commit: ce1dd9260a8bad9a7b097e24bf4fdc9a6833bae2
https://github.com/scummvm/scummvm/commit/ce1dd9260a8bad9a7b097e24bf4fdc9a6833bae2
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-06-18T08:20:39+03:00
Commit Message:
WINTERMUTE: Move alpha mask handling into the renderer classes
Changed paths:
engines/wintermute/base/gfx/base_surface.h
engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
engines/wintermute/base/gfx/osystem/base_surface_osystem.h
engines/wintermute/video/video_theora_player.cpp
engines/wintermute/video/video_theora_player.h
diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h
index 452d4e3890a..1c4ea459534 100644
--- a/engines/wintermute/base/gfx/base_surface.h
+++ b/engines/wintermute/base/gfx/base_surface.h
@@ -57,6 +57,9 @@ public:
virtual bool restore();
virtual bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) = 0;
virtual bool create(int width, int height);
+ virtual bool setAlphaImage(const Common::String &filename) {
+ return STATUS_FAILED;
+ }
virtual bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) {
return STATUS_FAILED;
}
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
index 74c9a738598..572035f1440 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
@@ -35,23 +35,31 @@
namespace Wintermute {
BaseSurfaceOpenGL3D::BaseSurfaceOpenGL3D(BaseGame *game, BaseRenderer3D *renderer)
- : BaseSurface(game), _tex(0), _renderer(renderer), _imageData(nullptr), _texWidth(0), _texHeight(0) {
+ : BaseSurface(game), _tex(0), _renderer(renderer), _imageData(nullptr), _maskData(nullptr), _texWidth(0), _texHeight(0) {
}
BaseSurfaceOpenGL3D::~BaseSurfaceOpenGL3D() {
glDeleteTextures(1, &_tex);
_renderer->invalidateTexture(this);
_tex = 0;
- delete[] _imageData;
+
+ if (_imageData) {
+ _imageData->free();
+ delete _imageData;
+ _imageData = nullptr;
+ }
+
+ if (_maskData) {
+ _maskData->free();
+ delete _maskData;
+ _maskData = nullptr;
+ }
}
bool BaseSurfaceOpenGL3D::invalidate() {
glDeleteTextures(1, &_tex);
_renderer->invalidateTexture(this);
_tex = 0;
- _imageData->free();
- delete[] _imageData;
- _imageData = nullptr;
_valid = false;
return true;
@@ -138,6 +146,7 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
if (_imageData) {
_imageData->free();
delete _imageData;
+ _imageData = nullptr;
}
#ifdef SCUMM_BIG_ENDIAN
@@ -234,6 +243,7 @@ bool BaseSurfaceOpenGL3D::putSurface(const Graphics::Surface &surface, bool hasA
if (_imageData && _imageData != &surface) {
_imageData->copyFrom(surface);
+ writeAlpha(_imageData, _maskData);
}
_width = surface.w;
@@ -252,7 +262,7 @@ bool BaseSurfaceOpenGL3D::putSurface(const Graphics::Surface &surface, bool hasA
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _texWidth, _texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, const_cast<void *>(surface.getPixels()));
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, _imageData->getPixels());
glBindTexture(GL_TEXTURE_2D, 0);
_valid = true;
@@ -306,6 +316,61 @@ void BaseSurfaceOpenGL3D::setTexture() {
glBindTexture(GL_TEXTURE_2D, _tex);
}
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOpenGL3D::setAlphaImage(const Common::String &filename) {
+ BaseImage *alphaImage = new BaseImage();
+ if (!alphaImage->loadFile(filename)) {
+ delete alphaImage;
+ return false;
+ }
+
+ if (_maskData) {
+ _maskData->free();
+ delete _maskData;
+ _maskData = nullptr;
+ }
+
+ Graphics::AlphaType type = alphaImage->getSurface()->detectAlpha();
+ if (type != Graphics::ALPHA_OPAQUE) {
+#ifdef SCUMM_BIG_ENDIAN
+ _maskData = alphaImage->getSurface()->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
+#else
+ _maskData = alphaImage->getSurface()->convertTo(Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24));
+#endif
+ }
+
+ delete alphaImage;
+
+ return true;
+}
+
+void BaseSurfaceOpenGL3D::writeAlpha(Graphics::Surface *surface, const Graphics::Surface *mask) {
+ if (mask && surface->w == mask->w && surface->h == mask->h) {
+ assert(mask->pitch == mask->w * 4);
+ assert(mask->format.bytesPerPixel == 4);
+ assert(surface->pitch == surface->w * 4);
+ assert(surface->format.bytesPerPixel == 4);
+ const byte *alphaData = (const byte *)mask->getPixels();
+#ifdef SCUMM_LITTLE_ENDIAN
+ int alphaPlace = (mask->format.aShift / 8);
+#else
+ int alphaPlace = 3 - (mask->format.aShift / 8);
+#endif
+ alphaData += alphaPlace;
+ byte *imgData = (byte *)surface->getPixels();
+#ifdef SCUMM_LITTLE_ENDIAN
+ imgData += (surface->format.aShift / 8);
+#else
+ imgData += 3 - (surface->format.aShift / 8);
+#endif
+ for (int i = 0; i < surface->w * surface->h; i++) {
+ *imgData = *alphaData;
+ alphaData += 4;
+ imgData += 4;
+ }
+ }
+}
+
} // End of namespace Wintermute
#endif // defined(USE_OPENGL_GAME) || defined(USE_OPENGL_SHADERS)
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
index c2121599772..481c46bcb16 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.h
@@ -48,6 +48,7 @@ public:
bool displayTiled(int x, int y, Rect32 rect, int numTimesX, int numTimesY) override;
bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
bool create(int width, int height) override;
+ bool setAlphaImage(const Common::String &filename) override;
bool putSurface(const Graphics::Surface &surface, bool hasAlpha = false) override;
bool getPixel(int x, int y, byte *r, byte *g, byte *b, byte *a = nullptr) override;
bool startPixelOp() override;
@@ -72,8 +73,11 @@ private:
GLuint _tex;
BaseRenderer3D *_renderer;
Graphics::Surface *_imageData;
+ Graphics::Surface *_maskData;
uint _texWidth;
uint _texHeight;
+
+ void writeAlpha(Graphics::Surface *surface, const Graphics::Surface *mask);
};
} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
index ac76d5a7c31..c388ab45f2f 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp
@@ -51,6 +51,7 @@ BaseSurfaceOSystem::BaseSurfaceOSystem(BaseGame *inGame) : BaseSurface(inGame) {
_surface = new Graphics::Surface();
_alphaMask = nullptr;
_alphaType = Graphics::ALPHA_FULL;
+ _alphaMaskType = Graphics::ALPHA_OPAQUE;
_lockPixels = nullptr;
_lockPitch = 0;
_loaded = false;
@@ -65,8 +66,11 @@ BaseSurfaceOSystem::~BaseSurfaceOSystem() {
_surface = nullptr;
}
- delete[] _alphaMask;
- _alphaMask = nullptr;
+ if (_alphaMask) {
+ _alphaMask->free();
+ delete _alphaMask;
+ _alphaMask = nullptr;
+ }
_gameRef->addMem(-_width * _height * 4);
BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
@@ -110,8 +114,11 @@ bool BaseSurfaceOSystem::finishLoad() {
_width = image->getSurface()->w;
_height = image->getSurface()->h;
- _surface->free();
- delete _surface;
+ if (_surface) {
+ _surface->free();
+ delete _surface;
+ _surface = nullptr;
+ }
bool needsColorKey = false;
bool replaceAlpha = true;
@@ -330,7 +337,8 @@ bool BaseSurfaceOSystem::drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect,
// Optimize by not doing alpha-blits if we lack alpha
// If angle is not 0, then transparent regions are added near the corners
- if (_alphaType == Graphics::ALPHA_OPAQUE && transform._angle == 0) {
+ if (_alphaType == Graphics::ALPHA_OPAQUE && _alphaMaskType == Graphics::ALPHA_OPAQUE &&
+ transform._angle == 0) {
transform._alphaDisable = true;
}
@@ -346,10 +354,13 @@ bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAl
_surface->free();
_surface->copyFrom(surface);
}
+
+ writeAlpha(_surface, _alphaMask);
+
if (hasAlpha) {
- _alphaType = Graphics::ALPHA_FULL;
+ _alphaType = _surface->detectAlpha();
} else {
- _alphaType = Graphics::ALPHA_OPAQUE;
+ _alphaType = _alphaMaskType;
}
BaseRenderOSystem *renderer = static_cast<BaseRenderOSystem *>(_gameRef->_renderer);
renderer->invalidateTicketsFromSurface(this);
@@ -357,4 +368,55 @@ bool BaseSurfaceOSystem::putSurface(const Graphics::Surface &surface, bool hasAl
return STATUS_OK;
}
+//////////////////////////////////////////////////////////////////////////
+bool BaseSurfaceOSystem::setAlphaImage(const Common::String &filename) {
+ BaseImage *alphaImage = new BaseImage();
+ if (!alphaImage->loadFile(filename)) {
+ delete alphaImage;
+ return false;
+ }
+
+ if (_alphaMask) {
+ _alphaMask->free();
+ delete _alphaMask;
+ _alphaMask = nullptr;
+ }
+
+ _alphaMaskType = alphaImage->getSurface()->detectAlpha();
+ if (_alphaMaskType != Graphics::ALPHA_OPAQUE) {
+ _alphaMask = alphaImage->getSurface()->convertTo(g_system->getScreenFormat());
+ }
+
+ delete alphaImage;
+
+ return true;
+}
+
+void BaseSurfaceOSystem::writeAlpha(Graphics::Surface *surface, const Graphics::Surface *mask) {
+ if (mask && surface->w == mask->w && surface->h == mask->h) {
+ assert(mask->pitch == mask->w * 4);
+ assert(mask->format.bytesPerPixel == 4);
+ assert(surface->pitch == surface->w * 4);
+ assert(surface->format.bytesPerPixel == 4);
+ const byte *alphaData = (const byte *)mask->getPixels();
+#ifdef SCUMM_LITTLE_ENDIAN
+ int alphaPlace = (mask->format.aShift / 8);
+#else
+ int alphaPlace = 3 - (mask->format.aShift / 8);
+#endif
+ alphaData += alphaPlace;
+ byte *imgData = (byte *)surface->getPixels();
+#ifdef SCUMM_LITTLE_ENDIAN
+ imgData += (surface->format.aShift / 8);
+#else
+ imgData += 3 - (surface->format.aShift / 8);
+#endif
+ for (int i = 0; i < surface->w * surface->h; i++) {
+ *imgData = *alphaData;
+ alphaData += 4;
+ imgData += 4;
+ }
+ }
+}
+
} // End of namespace Wintermute
diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
index b2b1725cdc3..dee4ff2fa24 100644
--- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.h
@@ -45,6 +45,8 @@ public:
bool create(const Common::String &filename, bool defaultCK, byte ckRed, byte ckGreen, byte ckBlue, int lifeTime = -1, bool keepLoaded = false) override;
bool create(int width, int height) override;
+ bool setAlphaImage(const Common::String &filename) override;
+
bool isTransparentAt(int x, int y) override;
bool isTransparentAtLite(int x, int y) override;
@@ -93,12 +95,14 @@ private:
bool _loaded;
bool finishLoad();
bool drawSprite(int x, int y, Rect32 *rect, Rect32 *newRect, Graphics::TransformStruct transformStruct);
+ void writeAlpha(Graphics::Surface *surface, const Graphics::Surface *mask);
float _rotation;
Graphics::AlphaType _alphaType;
void *_lockPixels;
int _lockPitch;
- byte *_alphaMask;
+ Graphics::Surface *_alphaMask;
+ Graphics::AlphaType _alphaMaskType;
};
} // End of namespace Wintermute
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
index 680194c6225..f7ab965f3f1 100644
--- a/engines/wintermute/video/video_theora_player.cpp
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -66,7 +66,6 @@ void VideoTheoraPlayer::SetDefaults() {
_dontDropFrames = false;
_texture = nullptr;
- _alphaImage = nullptr;
_alphaFilename = "";
_frameRendered = false;
@@ -95,14 +94,11 @@ VideoTheoraPlayer::~VideoTheoraPlayer() {
//////////////////////////////////////////////////////////////////////////
void VideoTheoraPlayer::cleanup() {
- _surface.free();
if (_theoraDecoder) {
_theoraDecoder->close();
}
delete _theoraDecoder;
_theoraDecoder = nullptr;
- delete _alphaImage;
- _alphaImage = nullptr;
delete _texture;
_texture = nullptr;
}
@@ -136,7 +132,6 @@ bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common:
_state = THEORA_STATE_PAUSED;
// Additional setup.
- _surface.create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight(), _theoraDecoder->getPixelFormat());
_texture = _gameRef->_renderer->createSurface();
_texture->create(_theoraDecoder->getWidth(), _theoraDecoder->getHeight());
_state = THEORA_STATE_PLAYING;
@@ -206,8 +201,6 @@ bool VideoTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame,
_playbackStarted = false;
float width, height;
if (_theoraDecoder) {
- _surface.free();
- _surface.copyFrom(*_theoraDecoder->decodeNextFrame());
_state = THEORA_STATE_PLAYING;
_looping = looping;
_playbackType = type;
@@ -313,17 +306,8 @@ bool VideoTheoraPlayer::update() {
if (_state == THEORA_STATE_PLAYING) {
if (!_theoraDecoder->endOfVideo() && _theoraDecoder->getTimeToNextFrame() == 0) {
const Graphics::Surface *decodedFrame = _theoraDecoder->decodeNextFrame();
- if (decodedFrame) {
- if (decodedFrame->format == _surface.format && decodedFrame->w == _surface.w && decodedFrame->h == _surface.h) {
- _surface.copyRectToSurface(*decodedFrame, 0, 0, Common::Rect(decodedFrame->w, decodedFrame->h));
- } else {
- _surface.free();
- _surface.copyFrom(*decodedFrame);
- }
-
- if (_texture) {
- writeVideo();
- }
+ if (decodedFrame && _texture) {
+ writeVideo(decodedFrame);
}
}
return STATUS_OK;
@@ -357,20 +341,14 @@ uint32 VideoTheoraPlayer::getMovieTime() const {
}
//////////////////////////////////////////////////////////////////////////
-bool VideoTheoraPlayer::writeVideo() {
+bool VideoTheoraPlayer::writeVideo(const Graphics::Surface *decodedFrame) {
if (!_texture) {
return STATUS_FAILED;
}
_texture->startPixelOp();
- writeAlpha();
- if (_alphaImage) {
- _texture->putSurface(_surface, true);
- } else {
- _texture->putSurface(_surface, false);
- }
-
+ _texture->putSurface(*decodedFrame, false);
//RenderFrame(_texture, &yuv);
_texture->endPixelOp();
@@ -378,33 +356,6 @@ bool VideoTheoraPlayer::writeVideo() {
return STATUS_OK;
}
-void VideoTheoraPlayer::writeAlpha() {
- if (_alphaImage && _surface.w == _alphaImage->getSurface()->w && _surface.h == _alphaImage->getSurface()->h) {
- assert(_alphaImage->getSurface()->pitch == _alphaImage->getSurface()->w * 4);
- assert(_alphaImage->getSurface()->format.bytesPerPixel == 4);
- assert(_surface.pitch == _surface.w * 4);
- assert(_surface.format.bytesPerPixel == 4);
- const byte *alphaData = (const byte *)_alphaImage->getSurface()->getPixels();
-#ifdef SCUMM_LITTLE_ENDIAN
- int alphaPlace = (_alphaImage->getSurface()->format.aShift / 8);
-#else
- int alphaPlace = 3 - (_alphaImage->getSurface()->format.aShift / 8);
-#endif
- alphaData += alphaPlace;
- byte *imgData = (byte *)_surface.getPixels();
-#ifdef SCUMM_LITTLE_ENDIAN
- imgData += (_surface.format.aShift / 8);
-#else
- imgData += 3 - (_surface.format.aShift / 8);
-#endif
- for (int i = 0; i < _surface.w * _surface.h; i++) {
- *imgData = *alphaData;
- alphaData += 4;
- imgData += 4;
- }
- }
-}
-
//////////////////////////////////////////////////////////////////////////
bool VideoTheoraPlayer::display(uint32 alpha) {
Rect32 rc;
@@ -429,11 +380,8 @@ bool VideoTheoraPlayer::display(uint32 alpha) {
//////////////////////////////////////////////////////////////////////////
bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) {
- delete _alphaImage;
- _alphaImage = new BaseImage();
- if (filename == "" || !_alphaImage || DID_FAIL(_alphaImage->loadFile(filename))) {
- delete _alphaImage;
- _alphaImage = nullptr;
+ assert(_texture);
+ if (filename == "" || !_texture || DID_FAIL(_texture->setAlphaImage(filename))) {
_alphaFilename = "";
return STATUS_FAILED;
}
@@ -441,8 +389,6 @@ bool VideoTheoraPlayer::setAlphaImage(const Common::String &filename) {
if (_alphaFilename != filename) {
_alphaFilename = filename;
}
- // TODO: Conversion.
- //_alphaImage->convert(IMG_TRUECOLOR);
return STATUS_OK;
}
diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h
index a807dd0ea74..550abab84d1 100644
--- a/engines/wintermute/video/video_theora_player.h
+++ b/engines/wintermute/video/video_theora_player.h
@@ -47,7 +47,6 @@ private:
THEORA_STATE_FINISHED = 3
};
Video::VideoDecoder *_theoraDecoder;
- Graphics::Surface _surface;
public:
DECLARE_PERSISTENT(VideoTheoraPlayer, BaseClass)
@@ -86,10 +85,8 @@ public:
BaseSurface *getTexture() const;
// alpha related
- BaseImage *_alphaImage;
Common::String _alphaFilename;
bool setAlphaImage(const Common::String &filename);
- void writeAlpha();
bool seekToTime(uint32 Time);
@@ -131,7 +128,7 @@ private:
bool _videoFrameReady;
float _videobufTime;
- bool writeVideo();
+ bool writeVideo(const Graphics::Surface *decodedFrame);
bool _playbackStarted;
Commit: 3328cdb969d875e1ffe4678b56ad1a09c688c421
https://github.com/scummvm/scummvm/commit/3328cdb969d875e1ffe4678b56ad1a09c688c421
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2025-06-18T08:20:39+03:00
Commit Message:
WINTERMUTE: Restore image deletion when OpenGL surfaces are invalidated
Changed paths:
engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
diff --git a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
index 572035f1440..79b028bd11b 100644
--- a/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_surface_opengl3d.cpp
@@ -61,6 +61,12 @@ bool BaseSurfaceOpenGL3D::invalidate() {
_renderer->invalidateTexture(this);
_tex = 0;
+ if (_imageData) {
+ _imageData->free();
+ delete _imageData;
+ _imageData = nullptr;
+ }
+
_valid = false;
return true;
}
@@ -208,6 +214,8 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
putSurface(*_imageData);
+ /* TODO: Delete _imageData if we no longer need to access the pixel data? */
+
if (_lifeTime == 0 || lifeTime == -1 || lifeTime > _lifeTime) {
_lifeTime = lifeTime;
}
@@ -217,8 +225,6 @@ bool BaseSurfaceOpenGL3D::create(const Common::String &filename, bool defaultCK,
_lifeTime = -1;
}
- _valid = true;
-
return true;
}
@@ -228,7 +234,9 @@ bool BaseSurfaceOpenGL3D::create(int width, int height) {
_texWidth = Common::nextHigher2(width);
_texHeight = Common::nextHigher2(height);
- glGenTextures(1, &_tex);
+ if (!_valid) {
+ glGenTextures(1, &_tex);
+ }
glBindTexture(GL_TEXTURE_2D, _tex);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _texWidth, _texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glBindTexture(GL_TEXTURE_2D, 0);
@@ -251,11 +259,9 @@ bool BaseSurfaceOpenGL3D::putSurface(const Graphics::Surface &surface, bool hasA
_texWidth = Common::nextHigher2(_width);
_texHeight = Common::nextHigher2(_height);
- if (_valid) {
- invalidate();
+ if (!_valid) {
+ glGenTextures(1, &_tex);
}
-
- glGenTextures(1, &_tex);
glBindTexture(GL_TEXTURE_2D, _tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
More information about the Scummvm-git-logs
mailing list