Resizing the window clears the texture

In Windows, changing the size of the window will delete the textures. But not all of them. Uploaded from disk remain. Those that are created by drawing over SDL_SetRenderTarget are deleted.

That’s correct. There’s an event when this happens, check out SDL_RENDER_TARGETS_RESET for D3D9 and SDL_RENDER_DEVICE_RESET for D3D11.

You can avoid this by using OpenGL as your renderer.

Cheers,

If it is correct, why is it not happening in Linux?

Because Linux uses OpenGL

Yes, this is what I do and it generally works very well. It has the useful side-effect that I can mix in direct OpenGL and GLSL (shader) code and everything works the same in Windows as on every other platform. However there are a few (generally older) PCs which have broken OpenGL drivers.

So OpenGL works bad …

Then you can use D3D and just handle the event when it happens.

1 Like

I changed to STATIC. IS there any simple method for that?

Another interesting fact:
I put a texture in STREAMING mode and another STATIC texture on it and the second texture is invisible. This is also correct?

What do you mean you “put a texture on it”?

SDL_RenderCopy(renderer, texture1,NULL, NULL)
SDL_RenderCopy(renderer, texture2,NULL, NULL)