| Summary: | Window resize, OpenGL context lost idea | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Achille Peternier <apeternier> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | ||
| Version: | 1.2.9 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
Proper OpenGL resizing support is planned for SDL 1.3, thanks for the idea though! |
Hi, I'm still surprised by the lack of a simple SDL_ResizeVideo function allowing to dynamically resize the window (under Windows, under other OSs I dunno) without loosing the current OpenGL context. So I simply added a function to SDL and it works! Why not implementing something similar in the official release? Here my perhaps naive solution, but perfectly working on every PC I tested so far (quite a lot of different HW configurations): /* * Update only the size of the window, without killing any context */ void SDL_ResizeVideoMode(int width, int height) { SDL_VideoDevice *video = current_video; video->screen->h = height; video->screen->w = width; /* Reset the mouse cursor and grab for new video mode */ video->UpdateMouse(video); } I just have to call that when I receive a SDL_RESIZE event, after I modified the glViewport. Dunno if this is a dirty and ugly solution for you, but it always worked for me and every time I update my SDL lib, I've to modify the SDL source code just to add this func. Pls let me know if there's a better way to get that and don't hesistate to tell me that I'm a dumb wheel reinventor! ;)