1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

OpenGL (Windows): Only trigger async update after first buffer swap

This fixes an issue where OpenGL would continuously repaint on Windows.
This commit is contained in:
Oliver James 2025-02-10 10:31:51 +00:00
parent 70652e3d23
commit 9c8a2b9609

View file

@ -142,7 +142,9 @@ public:
void swapBuffers() noexcept void swapBuffers() noexcept
{ {
SwapBuffers (dc.get()); SwapBuffers (dc.get());
triggerAsyncUpdate();
if (! std::exchange (haveBuffersBeenSwapped, true))
triggerAsyncUpdate();
} }
bool setSwapInterval (int numFramesPerSwap) bool setSwapInterval (int numFramesPerSwap)
@ -425,6 +427,7 @@ private:
OpenGLContext* context = nullptr; OpenGLContext* context = nullptr;
void* sharedContext = nullptr; void* sharedContext = nullptr;
double nativeScaleFactor = 1.0; double nativeScaleFactor = 1.0;
bool haveBuffersBeenSwapped = false;
//============================================================================== //==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeContext) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (NativeContext)