comparison src/video/win32/SDL_win32opengl.c @ 2180:5ed37b16c1a7

Yes, you need to set the pixel format before creating a context.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 12 Jul 2007 06:59:43 +0000
parents 114a541cfae2
children e1da92da346c
comparison
equal deleted inserted replaced
2179:8b76cc268771 2180:5ed37b16c1a7
338 static int 338 static int
339 WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs) 339 WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs)
340 { 340 {
341 HWND hwnd; 341 HWND hwnd;
342 HDC hdc; 342 HDC hdc;
343 PIXELFORMATDESCRIPTOR pfd;
343 HGLRC hglrc; 344 HGLRC hglrc;
344 int pixel_format = 0; 345 int pixel_format = 0;
345 unsigned int matching; 346 unsigned int matching;
346 347
347 hwnd = 348 hwnd =
348 CreateWindow(SDL_Appname, SDL_Appname, (WS_POPUP | WS_DISABLED), 0, 0, 349 CreateWindow(SDL_Appname, SDL_Appname, (WS_POPUP | WS_DISABLED), 0, 0,
349 10, 10, NULL, NULL, SDL_Instance, NULL); 350 10, 10, NULL, NULL, SDL_Instance, NULL);
350 WIN_PumpEvents(_this); 351 WIN_PumpEvents(_this);
351 352
352 hdc = GetDC(hwnd); 353 hdc = GetDC(hwnd);
354
355 WIN_GL_SetupPixelFormat(_this, &pfd);
356
357 SetPixelFormat(hdc, ChoosePixelFormat(hdc, &pfd), &pfd);
353 358
354 hglrc = _this->gl_data->wglCreateContext(hdc); 359 hglrc = _this->gl_data->wglCreateContext(hdc);
355 if (hglrc) { 360 if (hglrc) {
356 _this->gl_data->wglMakeCurrent(hdc, hglrc); 361 _this->gl_data->wglMakeCurrent(hdc, hglrc);
357 362