[SDL] Target textures getting randomly swapped on window resize !!
thephanoo at gmail.com
Wed Sep 14 17:59:58 PDT 2016
Please, compile this little program and look what happens when you resize the window. Basically, i create two coloured textures, and i display only the second. For some reason SDL will toggle between textures A and B every time you resize the window !!! [Shocked]
You can even have more fun creating 4 textures (A, B, C, D) and doing renderCopy on D to see SDL switching between all of them from the last to the first.
Interestingly, it works only backwards, i mean if you have 4 target textures and telling sdl to display the 1st, it'll only display the 1st. If you tell to display the 2nd, it'll switch between 1st and 2nd...
WTF is happening rly...
SDL_Window* window = SDL_CreateWindow("test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 200, 200, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
SDL_Texture* a = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_BGRA4444, SDL_TEXTUREACCESS_TARGET, 50, 50);
SDL_SetRenderDrawColor(renderer, 255, 0, 0, 255);
SDL_Texture* b = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_BGRA4444, SDL_TEXTUREACCESS_TARGET, 50, 50);
SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
SDL_RenderCopy(renderer, b, NULL, NULL);
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SDL