Changeset View
Changeset View
Standalone View
Standalone View
intern/ghost/intern/GHOST_SystemWin32.cpp
| Show First 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | GHOST_IWindow *GHOST_SystemWin32::createWindow(const STR_String &title, | ||||
| return window; | return window; | ||||
| } | } | ||||
| /** | /** | ||||
| * Create a new offscreen context. | * Create a new offscreen context. | ||||
| * Never explicitly delete the window, use #disposeContext() instead. | * Never explicitly delete the window, use #disposeContext() instead. | ||||
| * \return The new context (or 0 if creation failed). | * \return The new context (or 0 if creation failed). | ||||
| */ | */ | ||||
| GHOST_IContext *GHOST_SystemWin32::createOffscreenContext() | GHOST_IContext *GHOST_SystemWin32::createOffscreenContext( | ||||
| GHOST_PlatformSupportCallbackPtr platform_support_callback) | |||||
| { | { | ||||
| bool debug_context = false; /* TODO: inform as a parameter */ | bool debug_context = false; /* TODO: inform as a parameter */ | ||||
| GHOST_Context *context; | GHOST_Context *context; | ||||
| if (platform_support_callback) { | |||||
| char title[1024]; | |||||
brecht: Define a constant for this rather than hardcoding 1024. | |||||
| char message[1024]; | |||||
| char link[1024]; | |||||
| GHOST_DialogOptions dialog_options = platform_support_callback(title, message, link); | |||||
| if (dialog_options & GHOST_DialogShow) { | |||||
| showMessageBox(title, message, link, dialog_options); | |||||
| } | |||||
| if (dialog_options & GHOST_DialogExit) { | |||||
| exit(); | |||||
| } | |||||
| } | |||||
| HWND wnd = CreateWindowA("STATIC", | HWND wnd = CreateWindowA("STATIC", | ||||
| "BlenderGLEW", | "BlenderGLEW", | ||||
| WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| 64, | 64, | ||||
| 64, | 64, | ||||
| NULL, | NULL, | ||||
| Show All 33 Lines | context = new GHOST_ContextWGL(false, | ||||
| 3, | 3, | ||||
| (debug_context ? WGL_CONTEXT_DEBUG_BIT_ARB : 0), | (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()) { | ||||
| goto finished; | goto finished; | ||||
| } | } | ||||
| else { | else { | ||||
| MessageBox(NULL, | |||||
| "A graphics card and driver with support for OpenGL 3.3 or higher is required.\n" | |||||
| "Installing the latest driver for your graphics card may resolve the issue.\n\n" | |||||
| "The program will now close.", | |||||
| "Blender - Unsupported Graphics Card or Driver", | |||||
| MB_OK | MB_ICONERROR); | |||||
| delete context; | |||||
| exit(); | exit(); | ||||
| } | } | ||||
| #elif defined(WITH_GL_PROFILE_COMPAT) | #elif defined(WITH_GL_PROFILE_COMPAT) | ||||
| // ask for 2.1 context, driver gives any GL version >= 2.1 | // ask for 2.1 context, driver gives any GL version >= 2.1 | ||||
| // (hopefully the latest compatibility profile) | // (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(false, | context = new GHOST_ContextWGL(false, | ||||
| ▲ Show 20 Lines • Show All 1,395 Lines • ▼ Show 20 Lines | if (OpenClipboard(NULL)) { | ||||
| } | } | ||||
| CloseClipboard(); | CloseClipboard(); | ||||
| } | } | ||||
| else { | else { | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title, | |||||
| const char *message, | |||||
| const char *link, | |||||
| GHOST_DialogOptions dialog_options) const | |||||
| { | |||||
| MessageBox(NULL, message, title, MB_OK | MB_ICONERROR); | |||||
| return GHOST_kSuccess; | |||||
| } | |||||
| static DWORD GetParentProcessID(void) | static DWORD GetParentProcessID(void) | ||||
| { | { | ||||
| HANDLE snapshot; | HANDLE snapshot; | ||||
| PROCESSENTRY32 pe32 = {0}; | PROCESSENTRY32 pe32 = {0}; | ||||
| DWORD ppid = 0, pid = GetCurrentProcessId(); | DWORD ppid = 0, pid = GetCurrentProcessId(); | ||||
| snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); | ||||
| if (snapshot == INVALID_HANDLE_VALUE) { | if (snapshot == INVALID_HANDLE_VALUE) { | ||||
| return -1; | return -1; | ||||
| ▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines | |||||
Define a constant for this rather than hardcoding 1024.