summaryrefslogtreecommitdiff
path: root/Editor/GUI/GUIWindow.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-18 19:56:41 +0800
committerchai <chaifix@163.com>2021-10-18 19:56:41 +0800
commit45328cbadd8a946c19a77301f218efbf650e2f28 (patch)
tree8ec4f3a9737b2cbb9744f8347a56783743be2a4c /Editor/GUI/GUIWindow.cpp
parentb5702ece4c2cf751c252e76fb885a7ec41ccabe8 (diff)
*misc
Diffstat (limited to 'Editor/GUI/GUIWindow.cpp')
-rw-r--r--Editor/GUI/GUIWindow.cpp14
1 files changed, 13 insertions, 1 deletions
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;
}