Discussion:
Various issues with SDL 2's render API.
(too old to reply)
mr_tawan
2014-06-19 10:33:44 UTC
Permalink
My last issue is with scaling textures. The best platform-independent algorithm, linear filtering, is still largely inferior to the bilinear interpolation algorithm that we use right now. My question is the same as with color modulation: is this something that can be fixed in SDL2 with a patch, or it's an inherent feature of OGL/D3D?
The texture interpolation is performed on hw. So yes it's OGL/D3D feature. If it's not good enough for you, probably you would have to switch to anisotropic which is not available in OpenGL renderer. I think it's possible to implement anisotropic filtering on OpenGL renderer. What really needs here is to check if the anisotropic filtering extension is available or not, and if it's not just return FALSE at SDL_SetHint(). Shouldn't be really hard I guess.
mr_tawan
2014-06-20 17:43:20 UTC
Permalink
I've looked through the source code of the directx renderer. Surprisingly (to me), quality 'best' ('2') is not implemented. Instead it is treated the same way as quality 'good' ('1'). It's even commented in the code that currently quality '2' is the same as '1'.

That means only nearest neighbourhood and linear interpolation are implemented in both directx and opengl renderers (+ a few more).

Anyway I still doubt the quality of anisotropic filtering, given that sdl renderer renders everything in orthogonal projection and there is no rotation around x or y axis (it's 2D, in other words). Probably bi-linear would produce better quality output.
T. Joseph Carter
2014-06-20 23:24:19 UTC
Permalink
Bilinear and bicubic should be used for "best" quality where possible
(ie, anywhere you can use a shader). People swear by bicubic for
resizing, but the fact is that it's crap as a min filter. As a mag
filter, it's great. :)

Joseph
Post by mr_tawan
I've looked through the source code of the directx renderer. Surprisingly (to me), quality 'best' ('2') is not implemented. Instead it is treated the same way as quality 'good' ('1'). It's even commented in the code that currently quality '2' is the same as '1'.
That means only nearest neighbourhood and linear interpolation are implemented in both directx and opengl renderers (+ a few more).
Anyway I still doubt the quality of anisotropic filtering, given that sdl renderer renders everything in orthogonal projection and there is no rotation around x or y axis (it's 2D, in other words). Probably bi-linear would produce better quality output.
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Jonathan Dearborn
2014-06-23 15:11:56 UTC
Permalink
Regarding blend modes... We're still discussing this in another thread.
If you can't wait, then you can either patch SDL yourself or use SDL_gpu
which does have fine control of the blend mode.

Jonny D



On Fri, Jun 20, 2014 at 7:24 PM, T. Joseph Carter <
Bilinear and bicubic should be used for "best" quality where possible (ie,
anywhere you can use a shader). People swear by bicubic for resizing, but
the fact is that it's crap as a min filter. As a mag filter, it's great.
:)
Joseph
Post by mr_tawan
I've looked through the source code of the directx renderer. Surprisingly
(to me), quality 'best' ('2') is not implemented. Instead it is treated the
same way as quality 'good' ('1'). It's even commented in the code that
currently quality '2' is the same as '1'.
That means only nearest neighbourhood and linear interpolation are
implemented in both directx and opengl renderers (+ a few more).
Anyway I still doubt the quality of anisotropic filtering, given that sdl
renderer renders everything in orthogonal projection and there is no
rotation around x or y axis (it's 2D, in other words). Probably bi-linear
would produce better quality output.
_______________________________________________
Post by mr_tawan
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
T. Joseph Carter
2014-06-23 18:43:53 UTC
Permalink
There's a reason I don't join committees. *sigh*

I give up, as people aren't actually reading my emails on the topic
anyway. SDL's renderer had two goals and it currently meets neither
of them. I'm completely disincentivized to actually write the patch
at this point.

Nothing I've proposed for SDL's renderer is actually complex or
beyond the scope of the promises made for it in 1.3's development.
It just requires the time of someone who understands it to actually
do the implementation. It's software and old school shaderless
OpenGL that would actually require some effort, and I could do those
pretty easily.

I just no longer have the desire to push against the "wisdom" of this
mailing list which remains convinced that drawing a triangle without
an accelerated 3D engine is some kind of black voodoo.

Joseph
Post by Jonathan Dearborn
Regarding blend modes... We're still discussing this in another thread.
If you can't wait, then you can either patch SDL yourself or use SDL_gpu
which does have fine control of the blend mode.
Jonny D
On Fri, Jun 20, 2014 at 7:24 PM, T. Joseph Carter <
Bilinear and bicubic should be used for "best" quality where possible (ie,
anywhere you can use a shader). People swear by bicubic for resizing, but
the fact is that it's crap as a min filter. As a mag filter, it's great.
:)
Joseph
Post by mr_tawan
I've looked through the source code of the directx renderer. Surprisingly
(to me), quality 'best' ('2') is not implemented. Instead it is treated the
same way as quality 'good' ('1'). It's even commented in the code that
currently quality '2' is the same as '1'.
That means only nearest neighbourhood and linear interpolation are
implemented in both directx and opengl renderers (+ a few more).
Anyway I still doubt the quality of anisotropic filtering, given that sdl
renderer renders everything in orthogonal projection and there is no
rotation around x or y axis (it's 2D, in other words). Probably bi-linear
would produce better quality output.
_______________________________________________
Post by mr_tawan
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
_______________________________________________
SDL mailing list
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Juan Manuel Borges Caño
2014-06-23 22:49:57 UTC
Permalink
2D API++
lipk
2014-06-20 10:19:45 UTC
Permalink
Hmm... I'll do some research on that then. Thanks for the answer.
lipk
2014-06-19 07:46:46 UTC
Permalink
Hello people,

I'm working on porting a game from SDL 1.2 to SDL 2, and ran into a couple of problems that I'm apparently resolve on my own:

I can't get the texture + software rendering + alpha blending combo work. The symptoms are that described in bug 2198 (https://bugzilla.libsdl.org/show_bug.cgi?id=2198), except that I can't get good results with SDL_RenderCopy either. I'd assume this is an SDL2 bug, but the docs claim that some blend modes won't work on all renderers... so I hope this is a bug and not intended behavior?

I'm admittedly inexperienced with low-level graphics concepts and algorithms, so it might be only my ignorance that I can't make sense of the formula used for color modulating. We would mainly use this feature to draw a layer of a certain color over an image, but that's not really possible with the src * (mod / 255) formula, partly because its effects depend on the value of the color channel and partly because, mod being an Uint8, it can't be used for brightening. So, I ask, is it possible to achieve an effect like dst = src + mod (even by possibly patching SDL2 on my own)? I thought about rendering a semi-transparent colored rectangle onto the texture, but the remarks section of SDL_SetRenderTarget implies that this is probably not a widely supported feature, and our software is supposed
to run on a very broad variety of platforms.

My last issue is with scaling textures. The best platform-independent algorithm, linear filtering, is still largely inferior to the bilinear interpolation algorithm that we use right now. My question is the same as with color modulation: is this something that can be fixed in SDL2 with a patch, or it's an inherent feature of OGL/D3D?

Thanks in advance![/url]
lipk
2014-06-24 09:40:56 UTC
Permalink
@Jonny D: Thanks, SDL_gpu looks promising. I'll definitely take a look!

@Joseph Carter: Was that reply intended for this thread? If yes, I'm sorry for not reading your emails, but, you see, I only registered less than a week ago.
Continue reading on narkive:
Loading...