comparison src/video/win32/SDL_win32opengl.c @ 3139:7f684f249ec9

indent
author Sam Lantinga <slouken@libsdl.org>
date Sat, 23 May 2009 22:41:08 +0000
parents cdeee9f9b14b
children f43c8f688f77
comparison
equal deleted inserted replaced
3125:d71d8ceda8b3 3139:7f684f249ec9
38 #define WGL_CONTEXT_FLAGS_ARB 0x2093 38 #define WGL_CONTEXT_FLAGS_ARB 0x2093
39 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 39 #define WGL_CONTEXT_DEBUG_BIT_ARB 0x0001
40 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002 40 #define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x0002
41 #endif 41 #endif
42 42
43 typedef HGLRC (APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int * attribList); 43 typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC,
44 HGLRC
45 hShareContext,
46 const int
47 *attribList);
44 48
45 int 49 int
46 WIN_GL_LoadLibrary(_THIS, const char *path) 50 WIN_GL_LoadLibrary(_THIS, const char *path)
47 { 51 {
48 LPTSTR wpath; 52 LPTSTR wpath;
500 context = _this->gl_data->wglCreateContext(hdc); 504 context = _this->gl_data->wglCreateContext(hdc);
501 } else { 505 } else {
502 PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB; 506 PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
503 HGLRC temp_context = _this->gl_data->wglCreateContext(hdc); 507 HGLRC temp_context = _this->gl_data->wglCreateContext(hdc);
504 if (!temp_context) { 508 if (!temp_context) {
505 SDL_SetError("Could not create GL context"); 509 SDL_SetError("Could not create GL context");
506 return NULL; 510 return NULL;
507 } 511 }
508 512
509 /* Make the context current */ 513 /* Make the context current */
510 if (WIN_GL_MakeCurrent(_this, window, temp_context) < 0) { 514 if (WIN_GL_MakeCurrent(_this, window, temp_context) < 0) {
511 WIN_GL_DeleteContext(_this, temp_context); 515 WIN_GL_DeleteContext(_this, temp_context);
512 return NULL; 516 return NULL;
513 } 517 }
514 518
515 wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC) _this->gl_data->wglGetProcAddress("wglCreateContextAttribsARB"); 519 wglCreateContextAttribsARB =
520 (PFNWGLCREATECONTEXTATTRIBSARBPROC) _this->gl_data->
521 wglGetProcAddress("wglCreateContextAttribsARB");
516 if (!wglCreateContextAttribsARB) { 522 if (!wglCreateContextAttribsARB) {
517 SDL_SetError("GL 3.x is not supported"); 523 SDL_SetError("GL 3.x is not supported");
518 context = temp_context; 524 context = temp_context;
519 } else { 525 } else {
520 int attribs[] = { 526 int attribs[] = {
521 WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, 527 WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version,
522 WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, 528 WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version,
523 0 529 0
524 }; 530 };
525 /* Create the GL 3.x context */ 531 /* Create the GL 3.x context */
526 context = wglCreateContextAttribsARB(hdc, 0, attribs); 532 context = wglCreateContextAttribsARB(hdc, 0, attribs);
527 /* Delete the GL 2.x context */ 533 /* Delete the GL 2.x context */
528 _this->gl_data->wglDeleteContext(temp_context); 534 _this->gl_data->wglDeleteContext(temp_context);
529 } 535 }
530 } 536 }
531 537
532 if (!context) { 538 if (!context) {
533 SDL_SetError("Could not create GL context"); 539 SDL_SetError("Could not create GL context");
534 return NULL; 540 return NULL;
535 } 541 }
536 542