SDL_SetHint or another way to use different scaling quality

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.

My current plan is to use

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “nearest”);

and

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “linear”);

before render calls. Questions:

  1. will this work on all platforms/graphics cards?

  2. will this hurt performance?

  3. is there some better way?

Thanks.------------------------
bigosaur.com

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).

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768On 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.

My current plan is to use

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “nearest”);

and

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “linear”);

before render calls. Questions:

  1. will this work on all platforms/graphics cards?

  2. will this hurt performance?

  3. is there some better way?

Thanks.


bigosaur.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

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).

Pallav Nawani
IronCode Gaming Private Limited
Website: http://www.ironcode.com
Twitter: http://twitter.com/Ironcode_Gaming
Facebook: http://www.facebook.com/Ironcode.Gaming
Mobile: 9997478768

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.

My current plan is to use

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “nearest”);

and

SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, “linear”);

before render calls. Questions:

  1. will this work on all platforms/graphics cards?

  2. will this hurt performance?

  3. is there some better way?

Thanks.


bigosaur.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org