Disable texture filtering per SDL_RenderCopy(Ex) call

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

For rendering some sprites with texture filtering and others not, I
would like to disable texture filtering conditionally per
SDL_RenderCopy(Ex) call. I want my game world and objects nicely
texture filtered, but for the bitmap fonts it really doesn’t work well
(letters bleed over into others).

I tried changing the SDL_HINT_RENDER_SCALE_QUALITY hint right before
the render copy call, but it wouldn’t do anything. Is there another
way to do it?

Regards,
Jonas Thiem
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)

iQIcBAEBAgAGBQJSYMj9AAoJECgTcNPC9Cd014AQAJDEOTEhy2usVYhN9wRHJPWh
piRVhnoBhSogSIespUqeKLtRC6IjoFlByZmXsr9djtNm0XyO8oPQjtOOFXiG+19R
xS//c2NkabAUBN8PHClSgPP4gPwf3fFTWN0/mDW8XfYcH0/EBApvLmJ5OXcjTK3u
i/kTDC1Frnhuh0NEKFdcx/Vr8tLwoFzAdpAj3Qiy235jpIMocF8VCh69HBVFxWrp
BMJhZYI4ZrSKANqbNoussDdIk+Kb4iUV+y2dIPNIulXdrkpByIyL23UnxVQoaC4h
0EVXubQSF5+rbBEzuU7JM/GszKS58oVAekSmAjpYqBw3thZbnhs59/hFkVu1qzAR
pq/ZQlSasApOve6bNGd0WE4l88ZawcZ/zDCLr/ZFvBwhUb9Jw8ZVufPQTVzxYi3i
WsEJXuamhZ0GtLlsmGFderoLX12ycKqcSS6pEQPSeB+/ZN51CU9CdKwRznD5rQnC
oKUV5B0+hkae4GETr9GJXxP6hdzUA47vf9V8u1J3LdWVw9uGqHjqpmQ0lko870wU
tyBpji4kX7npcDOwosZwSpSdu5AfMk942rqChhwhHOgy2R1GcRvvj/zkk7kDqfnQ
37TgqX9AIXRO8OZHnub604PyVmAh6nwG+KWJJmyag/CpYbgEgKvLmzeIHi5JAr9A
MnSrUNyExiO3Q2NvdXxG
=gTPa
-----END PGP SIGNATURE-----

I believe the hint applies during SDL_CreateTexture, and the scaling mode will apply to that texture.

For the time being you could just create two textures, and use the one with the filtering mode you currently need.

Changing texture filter modes may not be a cheap operation depending
on the backend. Just something to keep in mind. :slight_smile:

JosephOn Fri, Oct 18, 2013 at 07:37:09AM +0200, Jonas Thiem wrote:

Hi all,

For rendering some sprites with texture filtering and others not, I
would like to disable texture filtering conditionally per
SDL_RenderCopy(Ex) call. I want my game world and objects nicely
texture filtered, but for the bitmap fonts it really doesn’t work well
(letters bleed over into others).

I tried changing the SDL_HINT_RENDER_SCALE_QUALITY hint right before
the render copy call, but it wouldn’t do anything. Is there another
way to do it?

Regards,
Jonas Thiem

I’d have to look at how the textures are handled and I honestly
haven’t looked. It’s not “almost free” as you might be hoping in at
least OpenGL’s fixed pipeline (which is used by GLES v1 and the
desktop OpenGL backends). It will serialize any accesses to the
same texture, at the very least.

JosephOn Fri, Oct 18, 2013 at 02:53:23PM +0200, Jonas Thiem wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I’m truthfully curious: is it expensive with Direct3D or OpenGL? I
only know a bit of OpenGL and pretty much no Direct3D. And I can’t
imagine it being expensive with the software renderer…

While I acknowledge there are other backends around, those three are
the only ones truly relevant to me (and the software renderer only
half as much).

On 10/18/2013 08:52 AM, T. Joseph Carter wrote:

Changing texture filter modes may not be a cheap operation
depending on the backend. Just something to keep in mind. :slight_smile:

Joseph

On Fri, Oct 18, 2013 at 07:37:09AM +0200, Jonas Thiem wrote:

Hi all,

For rendering some sprites with texture filtering and others not,
I would like to disable texture filtering conditionally per
SDL_RenderCopy(Ex) call. I want my game world and objects nicely
texture filtered, but for the bitmap fonts it really doesn’t work
well (letters bleed over into others).

I tried changing the SDL_HINT_RENDER_SCALE_QUALITY hint right
before the render copy call, but it wouldn’t do anything. Is
there another way to do it?

Regards, Jonas Thiem
_______________________________________________ SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)

iQIcBAEBAgAGBQJSYS9DAAoJECgTcNPC9Cd0ef0P/3ULBdIIxWWi3HpuBpwep3Ng
z0Td+eK7Wr41cgo5kE0LewAW1Yt+ARzUG4O0TSPLV1pnYv2lHu09nt6BZmhCjZdh
g/Ze3c7bGcpdY2bFD+WFyOd9LJ6+RAIzfzuNsxCHCImbFZ2QcAtLllZSImClmLC8
zvUPt8VVLDqQKMO7oj4Giqq801bQezmTt9mISOX4z2S6MTSqwqAYk+ARTTUYQUj+
00xst+fVm9Bq8eThQBcWGwGddvZz+eiG+dTdBob1pQCk41vjQ3VYnFk7/I2oCVyZ
2Ii/PLVWDJSvQrtHpOkTHY+IVxhCamlLhKxYM6zY/Go0a611l59oy090/R81lBgp
Wd2NK8f43t0+Tr/UB2AiFKFVqzlb+7pd/5ThetW7aQWmJOBBg1AV1vLF726/pgba
YoTaw5qOhspIQW0NQEi8/9OawwATjoFu6v3RuNU9HtBraW4lkm4l3vY23zHlU05g
Ki0kjd5rF+742pl70d6KvyHJGltzrjdirVjCN7N4XUa9LZ+IvxcdXcQ9gzD9oGE1
3yaSQXzszdS6t3uRQzhTOQY3iTurBFC33aUtc8FD3Rn1csj7yjTKERyZcjJVb1iF
WRGYXTXBbjP/8YvtJroXE3Seam8QC4jrSSmfr9Qx5B+z8oGSAcDdoz9ZV/D7rVun
1yRcMrloivNrz4GxqtnX
=od7K
-----END PGP SIGNATURE-----


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