Changeset 11411 in vbox for trunk/src/VBox/HostServices/SharedOpenGL
- Timestamp:
- Aug 14, 2008 12:45:11 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedOpenGL/glwindrv.cpp
r8155 r11411 57 57 58 58 hwnd = pClient->hwnd= CreateWindow("VBoxOGL", "VirtualBox OpenGL", 59 60 61 59 WS_CAPTION | WS_POPUPWINDOW | WS_VISIBLE, 60 0, 0, 0, 0, 61 NULL, NULL, 0, NULL); 62 62 Assert(hwnd); 63 63 while(true) … … 87 87 int vboxglGlobalInit() 88 88 { 89 Log(("vboxglGlobalInit\n")); 90 91 WNDCLASS wc; 92 HWND hWnd; 93 89 94 #ifdef VBOX_OGL_DEBUG_WINDOW_OUTPUT 90 WNDCLASS wc;91 92 95 wc.style = CS_OWNDC; 93 96 wc.lpfnWndProc = VBoxOGLWndProc; … … 105 108 PIXELFORMATDESCRIPTOR pfd; 106 109 int iFormat; 107 /** @todo should NOT use the desktop window -> crashes the Intel OpenGL driver */ 108 HDC hdc = GetDC(0); 110 111 wc.style = CS_OWNDC; 112 wc.lpfnWndProc = DefWindowProc; 113 wc.cbClsExtra = 0; 114 wc.cbWndExtra = 0; 115 wc.hInstance = 0; 116 wc.hIcon = NULL; 117 wc.hCursor = NULL; 118 wc.hbrBackground = NULL; 119 wc.lpszMenuName = NULL; 120 wc.lpszClassName = "VBoxOGLDummy"; 121 RegisterClass( &wc ); 122 123 /* create dummy window to avoid Intel/Nvidia opengl drivers 124 * problem with DC from desktop window */ 125 hWnd = CreateWindow("VBoxOGLDummy", "", WS_POPUPWINDOW, 126 0, 0, 0, 0, NULL, NULL, 0, NULL ); 127 Assert(hWnd); 128 129 HDC hdc = GetDC(hWnd); 109 130 110 131 ZeroMemory(&pfd, sizeof(pfd)); … … 126 147 wglMakeCurrent(NULL, NULL); 127 148 wglDeleteContext(hRC); 128 ReleaseDC(0, hdc); 149 ReleaseDC(hWnd, hdc); 150 DestroyWindow(hWnd); 129 151 130 152 return VINF_SUCCESS; … … 138 160 int vboxglGlobalUnload() 139 161 { 140 Log(("vboxglGlobalUnload "));162 Log(("vboxglGlobalUnload\n")); 141 163 142 164 return VINF_SUCCESS; … … 154 176 int iFormat; 155 177 156 /** @todo should NOT use the desktop window -> crashes the Intel OpenGL driver */ 157 pClient->enable.hdc = GetDC(0); 178 if (!pClient->enable.hwnd) 179 { 180 pClient->enable.hwnd = CreateWindow("VBoxOGLDummy", "", WS_POPUPWINDOW, 181 0, 0, 0, 0, NULL, NULL, 0, NULL ); 182 } 183 184 Assert(pClient->enable.hwnd); 185 pClient->enable.hdc = GetDC(pClient->enable.hwnd); 158 186 159 187 ZeroMemory(&pfd, sizeof(pfd)); … … 184 212 wglMakeCurrent(NULL, NULL); 185 213 wglDeleteContext(pClient->enable.hglrc); 186 ReleaseDC(0, pClient->enable.hdc); 214 ReleaseDC(pClient->enable.hwnd, pClient->enable.hdc); 215 if (pClient->enable.hwnd) 216 { 217 DestroyWindow(pClient->enable.hwnd); 218 pClient->enable.hwnd = 0; 219 } 187 220 return VINF_SUCCESS; 188 221 } … … 214 247 if (pClient->hdc) 215 248 ReleaseDC(pClient->hwnd, pClient->hdc); 216 249 PostMessage(pClient->hwnd, WM_CLOSE, 0, 0); 217 250 pClient->hwnd = 0; 218 251 }
Note:
See TracChangeset
for help on using the changeset viewer.