• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Discussion Issue with draw_sprite_part_ext

NightFrost

Member
So I've been wondering if this is a hardware-related feature or an actual bug within GML. I noticed this first time when creating my 9slice border scripts so I'll use a similar example. Let's assume we have a 5x5 pixel sprite called spr_9slice_box with multiple colors:
Code:
R = Red
B = Blue
G = Green

R R B R R
R R B R R
B B G B B
R R B R R
R R B R R
So a basic 9slice border sprite. I could have used 3x3 pixels but the issue is easier to see with larger size. We'll throw in an object to room that only runs the following draw:
Code:
draw_sprite_part_ext(spr_9slice_box, 0, 2, 0, 1, 2, x, y, 100, 1, c_white, 1);
The code copies the two topmost blue pixels (1x2 pixel area) and stretches it horizontally by a factor of 100. So we get a 100x2 blue stripe. So far so good. But when we change the draw to:
Code:
draw_sprite_part_ext(spr_9slice_box, 0, 2, 0, 1, 2, x, y, 400, 1, c_white, 1);
We get a 400x2 blue stripe, but the rightmost pixels are red. They are the pixels immediately to the right of the area designated to be drawn. The issue arises when stretch is set to at least 256, which should have significance to anyone knowing binary and/or hexadecimal. Vertical stretch has the same issue. What I've considered about this, it would make sense if this was a hardware level thing (well, shader thing).

(My GPU is a Radeon, an MSI R9 380 card to be precise.)
 

Joe Ellis

Member
Is texture interpolation on or off? Cus it could be blending with the pixels next to that sprite on the texture page, and it gets worse the more stretched it is
 

NightFrost

Member
Interpolation is off. I also rechecked the size of the drawn image, it is 400px as commanded so the rightmost pixels are copying the wrong location. I also changed one of the pixels to yellow, and it is yellow in the drawn image, so it is definitely getting the color from the pixels from right of the area to copy.
 
Top