Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_WindowWin32.cpp
| Show First 20 Lines • Show All 616 Lines • ▼ Show 20 Lines | |||||
| GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType type) | GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType type) | ||||
| { | { | ||||
| if (type == GHOST_kDrawingContextTypeOpenGL) { | if (type == GHOST_kDrawingContextTypeOpenGL) { | ||||
| GHOST_Context *context; | GHOST_Context *context; | ||||
| #if defined(WITH_GL_PROFILE_CORE) | #if defined(WITH_GL_PROFILE_CORE) | ||||
| GHOST_TUns8 major, minor; | /* - AMD and Intel give us exactly this version | ||||
| * - NVIDIA gives at least this version <-- desired behavior | |||||
| if (GHOST_ContextWGL::getMaximumSupportedOpenGLVersion( | * So we ask for 4.5, 4.4 ... 3.3 in descending order to get the best version on the user's system. */ | ||||
| m_hWnd, | for (int minor = 5; minor >= 0; --minor) { | ||||
| m_wantStereoVisual, | |||||
| m_wantAlphaBackground, | |||||
| m_wantNumOfAASamples, | |||||
| WGL_CONTEXT_CORE_PROFILE_BIT_ARB, | |||||
| m_debug_context, | |||||
| &major, &minor)) | |||||
| { | |||||
| context = new GHOST_ContextWGL( | context = new GHOST_ContextWGL( | ||||
| m_wantStereoVisual, | m_wantStereoVisual, | ||||
| m_wantAlphaBackground, | m_wantAlphaBackground, | ||||
| m_wantNumOfAASamples, | m_wantNumOfAASamples, | ||||
| m_hWnd, | m_hWnd, | ||||
| m_hDC, | m_hDC, | ||||
| WGL_CONTEXT_CORE_PROFILE_BIT_ARB, | WGL_CONTEXT_CORE_PROFILE_BIT_ARB, | ||||
| major, minor, | 4, minor, | ||||
| (m_debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0), | (m_debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0), | ||||
| GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY); | GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY); | ||||
| if (context->initializeDrawingContext()) { | if (context->initializeDrawingContext()) { | ||||
| return context; | return context; | ||||
| } | } | ||||
| else { | else { | ||||
| delete context; | delete context; | ||||
| } | } | ||||
| } | } | ||||
| context = new GHOST_ContextWGL( | |||||
| m_wantStereoVisual, | |||||
| m_wantAlphaBackground, | |||||
| m_wantNumOfAASamples, | |||||
| m_hWnd, | |||||
| m_hDC, | |||||
| WGL_CONTEXT_CORE_PROFILE_BIT_ARB, | |||||
| 3, 3, | |||||
| (m_debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0), | |||||
| GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY); | |||||
| if (context->initializeDrawingContext()) { | |||||
| return context; | |||||
| } | |||||
| else { | else { | ||||
| MessageBox( | MessageBox( | ||||
| m_hWnd, | m_hWnd, | ||||
| "Blender requires a graphics driver with at least OpenGL 3.3 support.\n\n" | "Blender requires a graphics driver with at least OpenGL 3.3 support.\n\n" | ||||
| "The program will now close.", | "The program will now close.", | ||||
| "Blender - Unsupported Graphics Driver!", | "Blender - Unsupported Graphics Driver!", | ||||
| MB_OK | MB_ICONERROR); | MB_OK | MB_ICONERROR); | ||||
| delete context; | |||||
| exit(0); | exit(0); | ||||
| return NULL; | |||||
| } | } | ||||
| #elif defined(WITH_GL_PROFILE_COMPAT) | #elif defined(WITH_GL_PROFILE_COMPAT) | ||||
| // ask for 2.1 context, driver gives any GL version >= 2.1 (hopefully the latest compatibility profile) | // ask for 2.1 context, driver gives any GL version >= 2.1 (hopefully the latest compatibility profile) | ||||
| // 2.1 ignores the profile bit & is incompatible with core profile | // 2.1 ignores the profile bit & is incompatible with core profile | ||||
| context = new GHOST_ContextWGL( | context = new GHOST_ContextWGL( | ||||
| m_wantStereoVisual, | m_wantStereoVisual, | ||||
| m_wantAlphaBackground, | m_wantAlphaBackground, | ||||
| m_wantNumOfAASamples, | m_wantNumOfAASamples, | ||||
| m_hWnd, | m_hWnd, | ||||
| m_hDC, | m_hDC, | ||||
| 0, // no profile bit | 0, // no profile bit | ||||
| 2, 1, | 2, 1, | ||||
| (m_debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0), | (m_debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0), | ||||
| GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY); | GHOST_OPENGL_WGL_RESET_NOTIFICATION_STRATEGY); | ||||
| #else | |||||
| # error // must specify either core or compat at build time | |||||
| #endif | |||||
| if (context->initializeDrawingContext()) { | if (context->initializeDrawingContext()) { | ||||
| return context; | return context; | ||||
| } | } | ||||
| else { | else { | ||||
| delete context; | delete context; | ||||
| } | } | ||||
| #else | |||||
| # error // must specify either core or compat at build time | |||||
| #endif | |||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| void GHOST_WindowWin32::lostMouseCapture() | void GHOST_WindowWin32::lostMouseCapture() | ||||
| { | { | ||||
| if (m_hasMouseCaptured) { | if (m_hasMouseCaptured) { | ||||
| ▲ Show 20 Lines • Show All 370 Lines • Show Last 20 Lines | |||||