Fixed windows' context not activated by default after their creation

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1119 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2009-06-01 13:41:38 +00:00
parent d8dc34b199
commit f624f16350
3 changed files with 31 additions and 21 deletions

View file

@ -55,7 +55,7 @@
////////////////////////////////////////////////////////////
namespace
{
// This thread-local variable will hold the "gloabl" context for each thread
// This thread-local variable will hold the "global" context for each thread
sf::ThreadLocalPtr<sf::priv::ContextGL> ThreadContext(NULL);
// Now we create two global contexts.

View file

@ -140,16 +140,21 @@ void Window::Create(VideoMode Mode, const std::string& Title, unsigned long Wind
delete myWindow;
myWindow = priv::WindowImpl::New(Mode, Title, WindowStyle);
// Make sure another context is bound, so that:
// - the context creation can request OpenGL extensions if necessary
// - myContext can safely be destroyed (it's no longer bound)
Context Ctx;
{
// Make sure another context is bound, so that:
// - the context creation can request OpenGL extensions if necessary
// - myContext can safely be destroyed (it's no longer bound)
Context Ctx;
// Recreate the context
delete myContext;
myContext = priv::ContextGL::New(myWindow, Mode.BitsPerPixel, Settings);
// Recreate the context
delete myContext;
myContext = priv::ContextGL::New(myWindow, Mode.BitsPerPixel, Settings);
Initialize();
Initialize();
}
// Activate the window's context
SetActive();
}
@ -162,16 +167,21 @@ void Window::Create(WindowHandle Handle, const ContextSettings& Settings)
Close();
myWindow = priv::WindowImpl::New(Handle);
// Make sure another context is bound, so that:
// - the context creation can request OpenGL extensions if necessary
// - myContext can safely be destroyed (it's no longer bound)
Context Ctx;
{
// Make sure another context is bound, so that:
// - the context creation can request OpenGL extensions if necessary
// - myContext can safely be destroyed (it's no longer bound)
Context Ctx;
// Recreate the context
delete myContext;
myContext = priv::ContextGL::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, Settings);
// Recreate the context
delete myContext;
myContext = priv::ContextGL::New(myWindow, VideoMode::GetDesktopMode().BitsPerPixel, Settings);
Initialize();
Initialize();
}
// Activate the window's context
SetActive();
}