API reference / Images and textures
SDL_SetTextureScaleMode
Function, SDL3
Sets how a texture looks at a new size.
Declaration
#include <SDL3/SDL.h>
bool SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);Parameters
texture | The texture. |
scaleMode | SDL_SCALEMODE_NEAREST for hard edges, or SDL_SCALEMODE_LINEAR for smooth edges. |
Return value
True on success. On failure it returns false.
Example
SDL_SetTextureScaleMode(ship, SDL_SCALEMODE_NEAREST);See this code run in Load an image. Download the full program (.zip)
Notes
- Pixel art looks best with nearest. In SDL3, the default is linear.
In SDL2
The name is the same, but the modes are SDL_ScaleModeNearest and SDL_ScaleModeLinear.