Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/ghost/intern/GHOST_ContextWGL.cpp')
-rw-r--r--intern/ghost/intern/GHOST_ContextWGL.cpp43
1 files changed, 30 insertions, 13 deletions
diff --git a/intern/ghost/intern/GHOST_ContextWGL.cpp b/intern/ghost/intern/GHOST_ContextWGL.cpp
index 18c7844ad7b..35ebb2c78af 100644
--- a/intern/ghost/intern/GHOST_ContextWGL.cpp
+++ b/intern/ghost/intern/GHOST_ContextWGL.cpp
@@ -145,6 +145,10 @@ GHOST_TSuccess GHOST_ContextWGL::getSwapInterval(int &intervalOut)
GHOST_TSuccess GHOST_ContextWGL::activateDrawingContext()
{
+ if (m_init == false) {
+ initContext();
+ }
+
if (WIN32_CHK(::wglMakeCurrent(m_hDC, m_hGLRC))) {
return GHOST_kSuccess;
}
@@ -958,8 +962,32 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
goto error;
}
+ /* Only init the non-offscreen context directly */
+ if (!create_hDC) {
+ initContext();
+
+ initClearGL();
+ ::SwapBuffers(m_hDC);
+ }
+
+ return GHOST_kSuccess;
+error:
+ if (m_dummyPbuffer) {
+ if (m_hDC != NULL)
+ WIN32_CHK(::wglReleasePbufferDCARB(m_dummyPbuffer, m_hDC));
+
+ WIN32_CHK(::wglDestroyPbufferARB(m_dummyPbuffer));
+ }
+ ::wglMakeCurrent(prevHDC, prevHGLRC);
+ return GHOST_kFailure;
+
+}
+
+
+GHOST_TSuccess GHOST_ContextWGL::initContext()
+{
if (!WIN32_CHK(::wglMakeCurrent(m_hDC, m_hGLRC))) {
- goto error;
+ return GHOST_kFailure;
}
initContextGLEW();
@@ -973,8 +1001,7 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
glEnable(GL_POINT_SPRITE);
}
- initClearGL();
- ::SwapBuffers(m_hDC);
+ m_init = true;
#ifndef NDEBUG
const char *vendor = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
@@ -989,16 +1016,6 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
#endif
return GHOST_kSuccess;
-error:
- if (m_dummyPbuffer) {
- if (m_hDC != NULL)
- WIN32_CHK(::wglReleasePbufferDCARB(m_dummyPbuffer, m_hDC));
-
- WIN32_CHK(::wglDestroyPbufferARB(m_dummyPbuffer));
- }
- ::wglMakeCurrent(prevHDC, prevHGLRC);
- return GHOST_kFailure;
-
}