From 45328cbadd8a946c19a77301f218efbf650e2f28 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 18 Oct 2021 19:56:41 +0800 Subject: *misc --- Editor/GUI/GUIWindow.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Editor/GUI/GUIWindow.cpp') diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp index 3df0370..34d7705 100644 --- a/Editor/GUI/GUIWindow.cpp +++ b/Editor/GUI/GUIWindow.cpp @@ -1,6 +1,7 @@ #include "EditorWindows.h" #include "WinUtils.h" #include "Runtime/Graphics/OpenGL.h" +#include "Editor/Graphics/Graphics.h" static bool RedirectMouseWheel(HWND window, WPARAM wParam, LPARAM lParam) { @@ -223,10 +224,12 @@ void GUIWindow::Init(std::string name) ShowWindow(m_Handle, SW_SHOW); - if (!SetRenderContext()) + bool bRC = SetRenderContext(); + if (!bRC) log_error("Failed to setup rendering context"); log_info("Created GUIWindow " /*+ (long)this*/); + } bool GUIWindow::SetRenderContext() @@ -288,6 +291,15 @@ bool GUIWindow::SetRenderContext() return FALSE; // Return FALSE } + if (m_RC && !g_IsGLInitialized) + { + log_info("Initialize OpenGL"); + wglMakeCurrent(m_DC, m_RC); + if (!gladLoadGL()) { + log_error("³õʼ»¯GL´íÎó"); + } + g_IsGLInitialized = true; + } return true; } -- cgit v1.1-26-g67d0