Just wondering, Laurent, is it safe to comment out this line:
WglContext::WglContext(WglContext* shared) :
myWindow (NULL),
myDeviceContext(NULL),
myContext (NULL),
myOwnsWindow (true)
{
// Creating a dummy window is mandatory: we could create a memory DC but then
// its pixel format wouldn't match the regular contexts' format, and thus
// wglShareLists would always fail. Too bad...
// Create a dummy window (disabled and hidden)
myWindow = CreateWindowA("STATIC", "", WS_POPUP | WS_DISABLED, 0, 0, 1, 1, NULL, NULL, GetModuleHandle(NULL), NULL);
ShowWindow(myWindow, SW_HIDE);
myDeviceContext = GetDC(myWindow);
// Create the context
if (myDeviceContext)
CreateContext(shared, VideoMode::GetDesktopMode().BitsPerPixel, ContextSettings(0, 0, 0));
// Activate the context
//SetActive(true); <<<<----- is it safe to comment out this line?
}
I am not sure if other part of SFML relies on this behavior or uses this variant of the constructor that takes in a WglContext.
Currently the only one I am seeing that uses it is the defaultContext, so I am not very sure. If we comment it out, we can use the default context to set it as the current context before creating any window. something like:
GlContext* GlContext::New(const WindowImpl* owner, unsigned int bitsPerPixel, const ContextSettings& settings)
{
//Now we can use the default context that was created globally.
defaultContext.SetActive(true);
ContextType* context = new ContextType(&referenceContext, owner, bitsPerPixel, settings);
// Enable antialiasing if needed
if (context->GetSettings().AntialiasingLevel > 0)
glEnable(GL_MULTISAMPLE_ARB);
return context;
}
The reason I was asking if it was ok to comment out the SetActive in the constructor was because the default context is still active on the main thread and can't be used on other threads.
regards