I have two different types of textures in my game. Some are pixel-perfect sprites and other are various backgrounds. I like to scale the background using linear scaling, but for pixelated stuff I’d like to scale without blurring.
Eg, Call
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “linear”);
Just before you create bg texture, and
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “nearest”);
before you create pixel art texture.
Calling SDL_SetHint while rendering has no effect, because texture
properties are set when the texture is created.
Done this way, it should work on all cards, have no performance penalties
(linearly interpolated textures require more processing, but you can’t
avoid that).
I have two different types of textures in my game. Some are pixel-perfect
sprites and other are various backgrounds. I like to scale the background
using linear scaling, but for pixelated stuff I’d like to scale without
blurring.
Just a note here in case changing the filter mode is important: With
SDL_gpu, the texture scale filters are part of the per-texture GPU_Image
state and can be changed any time with GPU_SetImageFilter().
Jonny DOn Sat, Feb 28, 2015 at 4:29 AM, Pallav Nawani wrote:
Call SDL_SetHint BEFORE creating texture.
Eg, Call
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “linear”);
Just before you create bg texture, and
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “nearest”);
before you create pixel art texture.
Calling SDL_SetHint while rendering has no effect, because texture
properties are set when the texture is created.
Done this way, it should work on all cards, have no performance penalties
(linearly interpolated textures require more processing, but you can’t
avoid that).
On Fri, Feb 27, 2015 at 2:30 AM, mbabuskov <milan.babuskov at gmail.com> wrote:
Hi,
I have two different types of textures in my game. Some are pixel-perfect
sprites and other are various backgrounds. I like to scale the background
using linear scaling, but for pixelated stuff I’d like to scale without
blurring.