SDL_RenderCopy weird bug

Yeah, this is a fundamental problem with the current implementation of
SDL_RenderSetLogicalSize(),
as it doesn’t handle scaling very well (e.g. seams, lines the wrong width,
etc.)

We’re seriously considering reimplementing it in terms of a render to
texture implementation, which takes more memory but solves all of these
issues.On Sun, Jun 15, 2014 at 11:31 AM, mr_tawan <mr_tawan at hotmail.com> wrote:

I have been thinking about SDL_RenderSetLogicalSize() for a while. May
be its proper behavior is to do the post-processing (render everything in
logical size space, then scale it to match the real window size), rather
than to scale each object when it’s rendered on the screen. This should
solve artifacts problem in the case that no scaling involed with each
object (I mean, every object is rendered at it size in logical size space).

Scaling at the render time also cause the edge of the object contains
artifact even if there a gaps between objects, except that the gap contain
exact copy of the edge of the object. That would makes 2 gaps between
object, or 1 pixel-border on every object in other words.

Ps. I’m not really sure if I have expressed clearly enough or not.
Admitted that English is not my first language, sorry about that.


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

Actually I’m pretty interested in this topic. I went on checking out the code to see what can I do. Although it might not be so hard to implement the functionality (which involved with using a render target and performing screen-space coordinate transformation on mouse input) at the application level, it does look complicated to implement at the library and/or API level.

Just my 2 cents. :slight_smile:

Sam Lantinga wrote:

Yeah, this is a fundamental problem with the current implementation of??SDL_RenderSetLogicalSize(), as it doesn’t handle scaling very well (e.g. seams, lines the wrong width, etc.)

We’re seriously considering reimplementing it in terms of a render to texture implementation, which takes more memory but solves all of these issues.

  I have been thinking about SDL_RenderSetLogicalSize() for a while. May be its proper behavior is to do the post-processing (render everything in logical size space, then scale it to match the real window size), rather than to scale each object when it's rendered on the screen. This should solve artifacts problem in the case that no scaling involed with each object (I mean, every object is rendered at it size in logical size space).

Scaling at the render time also cause the edge of the object contains artifact even if there a gaps between objects, except that the gap contain exact copy of the edge of the object. That would makes 2 gaps between object, or 1 pixel-border on every object in other words.

Ps. I’m not really sure if I have expressed clearly enough or not. Admitted that English is not my first language, sorry about that.


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

:D> On Sun, Jun 15, 2014 at 11:31 AM, mr_tawan <@mr_tawan (@mr_tawan)> wrote:

Hello! First post here.

I have a single 320x200 texture that I draw scaled with SDL_RenderCopy, and I still get pixel artifacts within the scaled image. Look between the middle rows of these bricks:

[Image: http://i.imgur.com/1Wisz3x.png ]

Is this to be expected? And what’s the best workaround?

Currently, I’m imagining either (1) render a higher-pixel texture manually or (2) learn deep GL voodoo (including pixel shaders). I’m pretty sure the first would work, but it would get more CPU intensive. I know very little GL, so that’s a steep learning curve, and I’d presumably still have lots of ropes to learn.

Thanks much for any advice. I posted in this topic, because it seems related, although I’m not rendering multiple tiles here, just one 320x200 texture with tile-looking things inside it.