Re: Target textures getting randomly swapped on window resize !!
Eric Wing <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <CA+Q62MALm=3s6FyxNjJsQh2Szy9uzEDBx4CPEGvmAxa9v9Wh5w@mail.gmail.com> |
On 9/23/16, sgrsgsrg <[email protected]> wrote: > Got rid of the problem by regenerating all target textures on window > resize. > > Is there a way to avoid doing that ? This 'glitch' isnt documented anywhere, > and there is no fun handling that > You didn't say anything about what operating system and video card you are using, nor which renderer backend. I'll speculate that you are on Windows and by default, you use the Direct3D backend which is very susceptible to losing your textures on various window events. (OpenGL tends to be a little more resilient in my experience.) Unfortunately, you must handle this. However, this is documented and there are two SDL events you should look for. SDL_RENDER_TARGETS_RESET and SDL_RENDER_DEVICE_RESET. When these events occur, this is when you should reload your textures. https://wiki.libsdl.org/SDL_EventType -Eric