Skip to content

Commit

Permalink
Fix textures turning white after resizing window.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quipyowert2 committed Jun 16, 2023
1 parent eb7ef48 commit c8eeb02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions libgag/include/SDLGraphicContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ namespace GAGCore
Uint32 optionFlags;
std::string windowTitle;
std::string appIcon;
int resizeTimer;

public:
//! Constructor. Create a new window of size (w,h). If useGPU is true, use GPU for accelerated 2D (OpenGL or DX)
Expand Down
6 changes: 5 additions & 1 deletion libgag/src/GraphicContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1674,8 +1674,10 @@ namespace GAGCore
#ifdef HAVE_OPENGL
if (_gc->optionFlags & GraphicContext::USEGPU)
{
if (!resizeTimer && EventListener::instance()->isResizing())
resizeTimer++;
// upload
if (surface->dirty || EventListener::instance()->isResizing())
if (surface->dirty || resizeTimer)
surface->uploadToTexture();

// state change
Expand Down Expand Up @@ -2275,6 +2277,8 @@ namespace GAGCore
{
SDL_UpdateWindowSurface(window);
}
if (resizeTimer)
resizeTimer--;
}
}

Expand Down

0 comments on commit c8eeb02

Please sign in to comment.