GMS 2 draw_sprite_ext() - plus full screen

So, I have a bit of an odd one, I will do my best to explain. For some of the objects in my game (player and NPC specifically) I am drawing them in layers. I have a base sprite that the object uses plus in the Draw event, I am adding some additional pieces (such as clothes, hair, helmets, etc...). When I do this at the game's normal windowed resolution, it works great - everything looks seamless with these layered items.

When I go full screen with my game, the added sprites have a bit of distortion - almost like they are slightly rotated one way (like a half a degree almost). All the other sprites in the game, including the base sprite for the object, don't have this problem - just these additional sprites drawn in the Draw event. I know there is a lot to take into account when scaling pixel art and all that, but I would expect the base sprite to distort some if that was the issue (which it is not).

Here is an example:
GML:
draw_sprite_ext( current_hair, image_index, x, y, image_xscale, image_yscale, 1, c_white, 1 );
I am not doing anything with the image_xscale or image_yscale that I am aware of and I assume that would be the same values that the base sprite is increased by. I am using the exact coordinates of the object to place this sprite.

Here is the distorted sprite example - the helmet is the part that is weird.
sprite-distort.png

Here is when not in full screen, same exact everything else - you can see all the pixels line up.

no-distore.JPG

I can answer more questions as needed... it is just a strange thing.
 
Last edited:

Yal

šŸ§ *penguin noises*
GMC Elder
Sprites are actually drawn as two textured triangles in 3D space, so it's possible there's rounding quirks when computing the screen coordinates for sub-pixels that leads to this. This type of distortion usually depends on the screen, so you could get different distortions on other PCs (or none at all).

The easiest way to fix this is to turn off automatic application surface resizing - use surface_resize on the application surface to force it to be a given size, which forces your crisp pixelart to be in nice chunky pixels instead of being stretched out over magnified subpixels.
 
Sprites are actually drawn as two textured triangles in 3D space, so it's possible there's rounding quirks when computing the screen coordinates for sub-pixels that leads to this. This type of distortion usually depends on the screen, so you could get different distortions on other PCs (or none at all).

The easiest way to fix this is to turn off automatic application surface resizing - use surface_resize on the application surface to force it to be a given size, which forces your crisp pixelart to be in nice chunky pixels instead of being stretched out over magnified subpixels.
Cool - thanks for the info! I will need to dig a little to see how to do that exactly (turn off auto application surface resizing), but that makes sense as to why it is happening. And yeah, I think the distortion is a little different (though still present) on my other monitor, which is a different size.
 

TheouAegis

Member
Cool - thanks for the info! I will need to dig a little to see how to do that exactly (turn off auto application surface resizing), but that makes sense as to why it is happening. And yeah, I think the distortion is a little different (though still present) on my other monitor, which is a different size.
Out of curiosity, what is your game's normal resolution and what is the fullscreen resolution?
 

Yal

šŸ§ *penguin noises*
GMC Elder
I will need to dig a little to see how to do that exactly (turn off auto application surface resizing)
I told you how: using surface_resize on the application surface (global variable application_surface) will force it to be that size. (Normally it's resized whenever the window is resized, but if you manually change its size, it'll be stretched to cover the entire window instead).
 
I told you how: using surface_resize on the application surface (global variable application_surface) will force it to be that size. (Normally it's resized whenever the window is resized, but if you manually change its size, it'll be stretched to cover the entire window instead).
I see that now. Thanks again. I have done little with the application surface, so I had to look into it a bit more. I will let you know how it turns out.
 
Ok - here is an updated. I didn't have a ton of time, but I did play around with application surface manually setting the surface size. I tried a few different sizes - but they all have the same problem. I am going to hit it with some more sizes to see if I can find some that don't exhibit the problem.

I do appreciate the help and I will report back if I find a solution.
 
Top