The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_SetHint or another way to use different scaling quality
mbabuskov


Joined: 08 Feb 2015
Posts: 29
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.
SDL_SetHint or another way to use different scaling quality
Pallav Nawani


Joined: 19 May 2011
Posts: 122
Location: Dehradun, India
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 wrote:
Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

SDL_SetHint or another way to use different scaling quality
Jonny D


Joined: 12 Sep 2009
Posts: 932
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 D






On Sat, Feb 28, 2015 at 4:29 AM, Pallav Nawani wrote:
Quote:
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 wrote:


Quote:
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

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org