Home Game Development How to render a portion of a texture (upscaled) without affecting the border with SDL2?

How to render a portion of a texture (upscaled) without affecting the border with SDL2?

0
How to render a portion of a texture (upscaled) without affecting the border with SDL2?

[ad_1]

I noticed that render a portion of the texture, upscaling it, it affects is border values with the proximity of the outside remaining parts of the texture (when not using Neareast neighbour interpolation)

This is a problem when those 2 portions are 2 different frames: basically it is interpolating the border with the outside of the texture when need rescaling.

This causes frame/sprite artifacts.

Consider a texture atlas with multiple frames next to each other. Copying one frame is resulting having the border interpolated with another frame and this most likely is creating an artifact.

Is there any way to strictly render a portion of texture making SDL Renderer ignoring whatever else is outside the rect?

Simply copy and rescale only the rect given?

e.g:
The 2 frames:
enter image description here

1st frame on the bottom is altered by the values of the 2nd frame
enter image description here

2nd frame on the top is altered by the values of the 1st frame
enter image description here

This issue doesn’t happen if adding 1 pixel pad among the 2 frames or using 1 texture per frame. I am wondering is there any SDL2 settings to avoid this unwanted (subpixels?) interpolation?

Please also note that all the operations are performed with exact integers, so don’t understand really from where that “noise” could come from.
Could it be from some Video drivers settings?

[ad_2]

Previous article Our Must-Haves For Nintendo’s New Console
Next article The books that make the best holiday gifts this year
Hello there! My name is YoleeTeam, and I am thrilled to welcome you to AmazonianGames.com. As the premier destination for all things related to Amazon Games' universe, we are dedicated to providing you with the most exciting and immersive gaming experiences out there. From captivating visuals to exhilarating gameplay, our website is packed with comprehensive insights, updates, and reviews to keep you ahead of the game. Whether you're a seasoned gamer or new to the scene, I am here to guide you through this virtual frontier. If you have any questions or suggestions, feel free to reach out to me at john@yoleesolutions.com. Embark on your Amazon gaming journey today with AmazonianGames.com and let the adventure begin!