SDL_RenderCopy scaling artifacts |
Re: SDL_RenderCopy scaling artifacts |
mbabuskov
|
Are you sure you set hints before texture was created? Which hints did you try? Linear, nearest? |
|||||||||||||
|
SDL_RenderCopy scaling artifacts |
Pallav Nawani
|
Hints should be set before texture is created. Afterwards it doesn't matter.
What kind of artifacts? Can you upload a screenshot somewhere? 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 Wed, Mar 4, 2015 at 2:29 PM, mbabuskov wrote:
|
|||||||||||||
|
Re: SDL_RenderCopy scaling artifacts |
tjpalmer
|
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? |
|||||||||||||
|
Re: SDL_RenderCopy scaling artifacts |
mbabuskov
|
Won't or didn't? I using this for my game and it works fine. Perhaps there's something wrong with alpha channel on your image or something like that (for example I discovered that some graphics programs create files with unexpected extra data in the alpha channel that can messup the way it looks on screen). How are you loading image, is it from PNG file? Does to problem also show up when you load from BMP or JPG? If the problem is not visible in BMP/JPG then try fixing the PNG image. I recall have similar issues and just added a completely black layer behind the graphics, re-exported with Gimp and everything was fine afterwards. Also check if background color is saved in PNG. Could you post the original image file that shows artifacts when scaled? |
|||||||||||||
|
Re: SDL_RenderCopy scaling artifacts |
tjpalmer
|
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: |
|||||||||||||
|