OpenGLRenderer: Choose between OpenGL/OpenGL ES at loading

This commit is contained in:
Jérôme Leclercq
2021-11-02 09:13:12 +01:00
parent d872428658
commit 9946c17a23
7 changed files with 79 additions and 28 deletions

View File

@@ -19,6 +19,8 @@ namespace Nz::GL
bool WGLContext::Create(const WGLContext* baseContext, const ContextParams& params, const WGLContext* shareContext)
{
Destroy();
// Creating a context requires a device context, create window to get one
HWNDHandle window(::CreateWindowA("STATIC", nullptr, WS_DISABLED | WS_POPUP, 0, 0, 1, 1, nullptr, nullptr, GetModuleHandle(nullptr), nullptr));
if (!window)
@@ -47,6 +49,8 @@ namespace Nz::GL
{
NazaraAssert(window.type == WindowManager::Windows, "expected Windows window");
Destroy();
m_deviceContext = ::GetDC(static_cast<HWND>(window.windows.window));
if (!m_deviceContext)
{