SDL School

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

textureThe texture.
scaleModeSDL_SCALEMODE_NEAREST for hard edges, or SDL_SCALEMODE_LINEAR for smooth edges.

Return value

True on success. On failure it returns false.

Example

Load an image
SDL_SetTextureScaleMode(ship, SDL_SCALEMODE_NEAREST);

See this code run in Load an image. Download the full program (.zip)

Notes

In SDL2

The name is the same, but the modes are SDL_ScaleModeNearest and SDL_ScaleModeLinear.

See also