summaryrefslogtreecommitdiff
path: root/Editor/GUI/ContainerWindow.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-30 22:59:42 +0800
committerchai <chaifix@163.com>2021-10-30 22:59:42 +0800
commit26f05c6e3dcac9995345fb5a2b031be7e3ea79e9 (patch)
treefc32c3e9d235817df0be331a6100b7f8263facab /Editor/GUI/ContainerWindow.cpp
parentc3e259f4d29e9bdcb73617ad8e4d71f117b4d289 (diff)
*TextGenerator
Diffstat (limited to 'Editor/GUI/ContainerWindow.cpp')
-rw-r--r--Editor/GUI/ContainerWindow.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/Editor/GUI/ContainerWindow.cpp b/Editor/GUI/ContainerWindow.cpp
index 62c6cb7..01bb1e9 100644
--- a/Editor/GUI/ContainerWindow.cpp
+++ b/Editor/GUI/ContainerWindow.cpp
@@ -196,8 +196,8 @@ void ContainerWindow::DoPaint()
void ContainerWindow::SetAsRenderContext()
{
Assert(m_DC != NULL);
- Assert(m_RC != NULL);
- Assert(wglMakeCurrent(m_DC, m_RC));
+ Assert(g_GLRC != NULL);
+ Assert(wglMakeCurrent(m_DC, g_GLRC));
RECT rect;
GetWindowRect(m_Window, &rect);
glViewport(0, 0, rect.right - rect.left, rect.bottom - rect.top);
@@ -256,16 +256,15 @@ bool ContainerWindow::SetRenderContext()
int pf = 0;
DescribePixelFormat(m_DC, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
- if (!(m_RC = wglCreateContext(m_DC))) // Are We Able To Get A Rendering Context?
- {
- MessageBox(NULL, "Can't Create A GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
- return FALSE; // Return FALSE
- }
-
- if (m_RC && !g_IsGLInitialized)
+ if (g_GLRC == NULL || !g_IsGLInitialized)
{
+ if (!(g_GLRC = wglCreateContext(m_DC))) // Are We Able To Get A Rendering Context?
+ {
+ MessageBox(NULL, "Can't Create A GL Rendering Context.", "ERROR", MB_OK | MB_ICONEXCLAMATION);
+ return FALSE; // Return FALSE
+ }
log_info("Initialize OpenGL");
- wglMakeCurrent(m_DC, m_RC);
+ wglMakeCurrent(m_DC, g_GLRC);
if (!gladLoadGL()) {
log_error("³õʼ»¯GL´íÎó");
}