From d35fc89512db551b93c7e1f5f3c72f12df7b49cb Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Tue, 14 Sep 2010 18:59:30 +0000 Subject: [PATCH] Fixed a bug with threads and OpenGL context sharing git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1567 4e206d99-4929-0410-ac5d-dfc041789085 --- include/SFML/Graphics/RenderTarget.hpp | 2 +- src/SFML/Window/Linux/GlxContext.cpp | 9 ++++++++- src/SFML/Window/Win32/WglContext.cpp | 9 ++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/SFML/Graphics/RenderTarget.hpp b/include/SFML/Graphics/RenderTarget.hpp index 78172431..582ecd57 100644 --- a/include/SFML/Graphics/RenderTarget.hpp +++ b/include/SFML/Graphics/RenderTarget.hpp @@ -63,7 +63,7 @@ public : /// \param color Fill color to use to clear the render target /// //////////////////////////////////////////////////////////// - void Clear(const Color& color = Color(0, 0, 0)); + void Clear(const Color& color = Color(0, 0, 0, 255)); //////////////////////////////////////////////////////////// /// \brief Draw an object into the target diff --git a/src/SFML/Window/Linux/GlxContext.cpp b/src/SFML/Window/Linux/GlxContext.cpp index 28d24d02..44c72412 100644 --- a/src/SFML/Window/Linux/GlxContext.cpp +++ b/src/SFML/Window/Linux/GlxContext.cpp @@ -62,7 +62,14 @@ myOwnsWindow(true) CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0)); // Activate the context - SetActive(true); + if (shared) + SetActive(true); + + // -- Warning -- + // The "if (shared)" condition fixes this bug: + // http://www.sfml-dev.org/forum/viewtopic.php?p=20767#20767 + // However, it was already there before and removed at revision 1236, + // but without any comment... so it might cause other problems in the future } diff --git a/src/SFML/Window/Win32/WglContext.cpp b/src/SFML/Window/Win32/WglContext.cpp index 5f2da071..c5164580 100644 --- a/src/SFML/Window/Win32/WglContext.cpp +++ b/src/SFML/Window/Win32/WglContext.cpp @@ -59,7 +59,14 @@ myOwnsWindow (true) CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0)); // Activate the context - SetActive(true); + if (shared) + SetActive(true); + + // -- Warning -- + // The "if (shared)" condition fixes this bug: + // http://www.sfml-dev.org/forum/viewtopic.php?p=20767#20767 + // However, it was already there before and removed at revision 1236, + // but without any comment... so it might cause other problems in the future }