Tuesday, September 11, 2018

sdl2 - Will SDL_DestroyRenderer() destroy every texture created with it?


The documentation on the SDL wiki states:



Use this function to destroy the rendering context for a window and free associated textures



So does this mean that every texture I create will be freed (even those still used) or only the ones that were destroyed manually (by using SDL_DestroyTexture())?



Answer



It means that all existing textures are freed. I checked the SDL source and inside the SDL_DestroyRenderer function they do this:


while (renderer->textures) {
SDL_DestroyTexture(renderer->textures);

}

So every texture that was created with the renderer gets destroyed.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...