How to specify filter type used in SDL_RenderCopy when magnifying image?

By default, SDL_RenderCopy (or SDL_RenderCopyEx) applies a filter if srcRect is not of the same size as dstRect, say, when magnifying an image. I am wondering if SDL provides any way to specify other filter types like nearest neighbor, linear or cubic filtering, or any SDL APIs for users to specify user-defined filters when magnifying an image in rendering. Thanks a lot.

See https://wiki.libsdl.org/SDL_HINT_RENDER_SCALE_QUALITY. If your backend is OpenGL you may be able to achieve per-texture control by calling SDL_GL_BindTexture() to select the texture you want to affect and then calling glTexParameter() directly to set its filter.

2 Likes