How to scale textures smoothly below 50%

I am having the same problem as this person here:

https://forums.libsdl.org/viewtopic.php?p=46898

Scaling textures by using SDL_RenderCopy and a smaller target Rect is giving pixelated results. If I scale to 50% or larger (75%, 60% etc), it looks decent. But anything smaller, 40%, 30%, 25% etc looks bad and pixelated (sharp pixel edges).

I tried SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “best”) and SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “2”) but no matter what I change the scale quality to, it seems to have no effect on the output. 0, 1, and 2 all look the same.

I tried setting SDL_SetHint before/after creating the renderer and also before making the texture.

What could cause this? Thank you!

Hey there, welcome! There was a discussion about this topic recently here: Downscaling quality with SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best");

The problem is that most, if not all, render back-ends will sample from 4 pixels to determine pixel color, so when you scale below 50%, there are not enough pixels to make a correct color. A custom solution would be to make some mipmaps yourself, having your textures in different resolutions and choosing the most adequate according to the scale.

Again, i recommend checking the post above for the solutions.

Thank you, I will study that. It’s good to know I was at least doing it the right way.