Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Sprite .. scale .. pixel missing ..  (Read 1575 times)

0 Members and 1 Guest are viewing this topic.

HeinzK

  • Newbie
  • *
  • Posts: 41
    • View Profile
    • ZwiAner
    • Email
Sprite .. scale .. pixel missing ..
« on: February 23, 2018, 10:10:11 am »
deleted
« Last Edit: December 04, 2019, 08:35:34 am by HeinzK »
The trees, that obstruct the view on the forest, can be allowed to fall! (Die Bäume, die die Sicht auf einen Wald versperren, dürfen gefällt werden!)

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Sprite .. scale .. pixel missing ..
« Reply #1 on: February 23, 2018, 12:55:46 pm »
When you scale an object or the view, OpenGL has to match more pixels onto a smaller or larger space. As such it needs to interpolate which pixels to show and this might lead to "missing" pixels.

Say you have a range of 100 pixels. One one side, 20 pixels are red and on the other side one pixel is blue. When you now map 100 pixels to 1 pixel (scaling), how do you map these pixels now? Will one side now just be red and the other blue? How can 1 pixel blue be displayed the same as 20 pixel red? As such pixels get dropped.

The solution is to not scale at random factors, but factors that can easily be divided equally. If the desired object is always scaled to the given size, it might be better to redraw the object for that given size. That way you have the fully control over each pixel.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/