Logical scale pixel imprecision |
Christian Knudsen
|
You need to always have a 1 pixel wide empty border around each separate sprite on your texture atlas. (This isn't an SDL specific thing.)
|
|||||||||||
|
M-374 LX
|
One more problem happens when the hint SDL_HINT_RENDER_SCALE_QUALITY is set to "linear": the font, stored in white over a magenta background, is drawn with a blend between the two colors. Magenta is set as the color key.
|
|||||||||||
|
M-374 LX
|
The problem with linear scale quality seems to affect mostly the borders of white and grey images.
|
|||||||||||
|
Logical scale pixel imprecision |
Pallav Nawani
|
1. Create a render texture with same size as your logical size.
2. Set the render texture as the target and draw all your stuff into it. 3. remove the render texture as the target. 4. Now use SDL logical scaling to draw the render texture to the window This avoids the issue you are facing, and is the recommended way to go. Now, as to why logical scale pixel imprecision is happening. This is normal and actually not a bug. When you draw a texture with a size different from its original size, then the underlying graphics such as OpenGL has to generate the extra pixels by a process known as sampling. The smaller the original texture is, the bigger the problem. 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, May 6, 2015 at 5:37 AM, M-374 LX wrote:
|
|||||||||||||
|
M-374 LX
|
This solves my problems, Pallav Nawani. Thanks.
Another problem has happened: random images from the desktop were shown on the mattes created by the letterboxing effect. However, this can be solved by using SDL_RenderClear() to clear the screen before setting the render target back to the buffer texture. This may be a useful tip in case someone has a similar problem. |
|||||||||||
|
Christian Knudsen
|
You should always clear render targets if you aren't going to fill them in completely with draw calls or you'll end up with undefined areas.
|
|||||||||||
|