Mercurial > sdl-ios-xcode
comparison src/video/wincommon/SDL_wingl.c @ 671:338a62f9a528
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 08 Aug 2003 20:09:15 +0000 |
parents | 864e2d2a9a55 |
children | 92a933bf2f0f |
comparison
equal
deleted
inserted
replaced
670:b8679559e432 | 671:338a62f9a528 |
---|---|
85 HDC hdc; | 85 HDC hdc; |
86 HGLRC hglrc; | 86 HGLRC hglrc; |
87 int pformat; | 87 int pformat; |
88 const char * (WINAPI *wglGetExtensionsStringARB)(HDC) = 0; | 88 const char * (WINAPI *wglGetExtensionsStringARB)(HDC) = 0; |
89 | 89 |
90 hwnd = CreateWindow(NULL, "PFormat", WS_POPUP | WS_DISABLED, | 90 hwnd = CreateWindow(SDL_Appname, SDL_Appname, WS_POPUP | WS_DISABLED, |
91 0, 0, 10, 10, | 91 0, 0, 10, 10, |
92 NULL, NULL, SDL_Instance,NULL); | 92 NULL, NULL, SDL_Instance,NULL); |
93 hdc = GetDC(hwnd); | 93 hdc = GetDC(hwnd); |
94 | 94 |
95 pformat = ChoosePixelFormat(hdc, &GL_pfd); | 95 pformat = ChoosePixelFormat(hdc, &GL_pfd); |
96 SetPixelFormat(hdc, pformat, &GL_pfd); | 96 SetPixelFormat(hdc, pformat, &GL_pfd); |
97 | 97 |
98 hglrc = this->gl_data->wglCreateContext(hdc); | 98 hglrc = this->gl_data->wglCreateContext(hdc); |
99 this->gl_data->wglMakeCurrent(hdc, hglrc); | 99 if ( hglrc ) { |
100 this->gl_data->wglMakeCurrent(hdc, hglrc); | |
101 } | |
100 | 102 |
101 wglGetExtensionsStringARB = (const char * (WINAPI *)(HDC)) | 103 wglGetExtensionsStringARB = (const char * (WINAPI *)(HDC)) |
102 this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB"); | 104 this->gl_data->wglGetProcAddress("wglGetExtensionsStringARB"); |
103 | 105 |
104 if(wglGetExtensionsStringARB && strstr(wglGetExtensionsStringARB(hdc),"WGL_ARB_pixel_format")) { | 106 if(wglGetExtensionsStringARB && strstr(wglGetExtensionsStringARB(hdc),"WGL_ARB_pixel_format")) { |
116 this->gl_data->wgl_arb_pixel_format = 0; | 118 this->gl_data->wgl_arb_pixel_format = 0; |
117 } else { | 119 } else { |
118 this->gl_data->wgl_arb_pixel_format = 0; | 120 this->gl_data->wgl_arb_pixel_format = 0; |
119 } | 121 } |
120 | 122 |
121 this->gl_data->wglMakeCurrent(NULL, NULL); | 123 if ( hglrc ) { |
122 this->gl_data->wglDeleteContext(hglrc); | 124 this->gl_data->wglMakeCurrent(NULL, NULL); |
125 this->gl_data->wglDeleteContext(hglrc); | |
126 } | |
123 ReleaseDC(hwnd, hdc); | 127 ReleaseDC(hwnd, hdc); |
124 DestroyWindow(hwnd); | 128 DestroyWindow(hwnd); |
125 } | 129 } |
126 | 130 |
127 int WIN_GL_SetupWindow(_THIS) | 131 int WIN_GL_SetupWindow(_THIS) |