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_RenderCopy scaling artifacts
tjpalmer


Joined: 02 Mar 2015
Posts: 8
Take two (on a new topic now) to see if I can get help. I build a single 320x200 text in a pixel-specific way, and then I use SDL_RenderCopy to draw it at full window size. However, it has stray pixels. See for example between the middle row of bricks here: Is this expected behavior? I've tried setting hints, to no effect. Any recommendations?
SDL_RenderCopy scaling artifacts
tjpalmer


Joined: 02 Mar 2015
Posts: 8
mbabuskov wrote: Are you sure you set hints before texture was created? Which hints did you try? Linear, nearest?
Thanks so much for the reply. I had missed the need to set it before the texture is created. However, as I somewhat feared (though I still wanted to try it), this won't help. Linear doesn't have the stray pixels, but I really want nearest, because linear blurs. (Linear still has edge issues, too, at the very ends of the texture, although I think I know how to deal with that by putting a transparent edge in my texture.) I've tried scaling manually myself on CPU now, too. It looks just right, but it's too slow. (Current implementation is step by float, and truncate. Could look at optimizing.) I've considered all kinds of hacks (CPU scale to not full but still integer fraction of screen/window size, many other things, ...), but maybe I should just bite the bullet and go to GL and shaders. That's a bunch of extra work and learning curve, but I suspect I could get it to do the simple scaling that I want. Any other easy fixes I should try first?
SDL_RenderCopy scaling artifacts
tjpalmer


Joined: 02 Mar 2015
Posts: 8
mbabuskov wrote: Won't or didn't?
Didn't achieve the effect I need. Default seems to be nearest (and is shown in my earlier screenshot), which is what I want, if not for the artifacts. Here's what I want (from my manual C++ scaling code), nearest sans artifacts: And here is what linear does:
SDL_RenderCopy scaling artifacts
Jonny D


Joined: 12 Sep 2009
Posts: 932
Can you post the code you're using to render this?

Jonny D




On Wed, Mar 4, 2015 at 3:06 PM, tjpalmer wrote:
Quote:



mbabuskov wrote:

Won't or didn't?




Didn't achieve the effect I need. Default seems to be nearest (and is shown in my earlier screenshot), which is what I want, if not for the artifacts.

Here's what I want (from my manual C++ scaling code), nearest sans artifacts:



And here is what linear does:




_______________________________________________
SDL mailing list

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