| Summary: | Better error reporting for WIN_GL_CreateContext() | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Mason Wheeler <masonwheeler> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | minor | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | Other | ||
| OS: | Windows (All) | ||
There was already a function to do this, and I changed the code to use it. Thanks! |
If context creation fails, it would be nice to know why. --- C:\Users\Mason\AppData\Local\Temp\SDL_win32opengl.-revBASE.svn001.tmp.c 2009-12-14 19:11:16.000000000 -0800 +++ C:\Users\Mason\Documents\SDL-1.3\SDL-1.3.0-4423\src\video\win32\SDL_win32opengl.c 2009-09-05 10:31:30.000000000 -0800 @@ -533,13 +533,17 @@ /* Delete the GL 2.x context */ _this->gl_data->wglDeleteContext(temp_context); } } if (!context) { - SDL_SetError("Could not create GL context"); + char* error = SDL_malloc(255); + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, error, 255, NULL); + + SDL_SetError("Could not create GL context: %n", error); + SDL_free(error); return NULL; } if (WIN_GL_MakeCurrent(_this, window, context) < 0) { WIN_GL_DeleteContext(_this, context); return NULL;