Hi
I have a background texture 2048x2048 that I render with:
SDL_RenderCopyEx(renderer, texture,&SrcR,&DestR,mangle,NULL,SDL_FLIP_NONE);
Where the window size is 512x512.
The problem is that even though the background is rotating, I get artifacts in the corners where the texture isn’t updated.
Tried changing SrcR and DestR to all sorts of values, but I never get the artifacts gone completely.
How do I set it up so the background is rotated without artifacts?
With SrcR as NULL (or 2048x2048) and DestR as 724x724 (or larger) - large enough for the rotated texture always to fill the window whatever the angle - I wouldn’t have expected any artefacts. Can you confirm that you still see them even with those values?
The only Dest I got working is:
DestR.x = -256;
DestR.y = -256;
DestR.w = 1024;
DestR.h = 1024;
with dest =
DestR.x = 0;
DestR.y = 0;
DestR.w = 768;
DestR.h = 768;
I still get artifacts in one corner
That rectangle isn’t centred. Try:
DestR.w = 724;
DestR.h = 724;
DestR.x = -106;
DestR.y = -106;
You need to ensure that the destination rectangle is centred in your window, so in general:
DestR.x = (WindowWidth - DestR.w) / 2;
DestR.y = (WindowHeight - DestR.h) / 2;
Ahh yes, this works perfectly 