# Why does SDL2 blur pixel art even with SDL_HINT_RENDER_SCALE_QUALITY set to 0?

I am working on a game with SDL2 and having trouble turning off linear filtering when upscaling textures.

My game has a bunch of 32x32 tiles. I used SDL_RenderSetLogicalSize so that there is a one-to-one pixel mapping (i.e. my logical size is n * 32 x m * 32.)

However, when the the whole scene is upscaled to fit the actual screen, it seems to be interpolated (blurry).

I saw these two other posts (1, 2) which recommended using SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0");. I did that, but nothing seems to change at all. It returns true and it is in fact changing the hint, but the rendering just doesn't change at all. I even tried setting it with priority but nothing changes.

Any idea how to fix this? I am on Windows if that's relavent.

• Where do you call SDL_SetHint? – Tyyppi_77 Apr 15 '18 at 9:12
• @Tyyppi_77 I tried calling it every frame before drawing anything and also after initialization before starting my loop. It didn't seem to make a difference. Is there a particular place it is supposed to be? – B1CL0PS Apr 15 '18 at 14:10
• Yes, you need to call it before creating the textures. – Tyyppi_77 Apr 15 '18 at 14:40
• @Tyyppi_77 wow, that fixed it perfectly! I was doing it just after creating textures. Weird that I couldn't find that in the documentation anywhere. Thanks so much! – B1CL0PS Apr 15 '18 at 14:54

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "0"); needs to happen before texture creation.