• 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.

Windows Draw GUI offset by 1 pixel

Redspark

Member
Hi,

Don't know if this is a bug or just something to do with the resolution scaling that I'm not understanding. However, when I create a room with a size and viewport of 1280x720 and turn on full screen (1366x768) through window_set_fullscreen(true) then I find that the GUI layer is offset by 1 pixel. So if I draw in the draw_gui event, coordinates 0,0 are at 1,0 in the normal draw event. Is this a bug or am I misunderstanding how this should be working? Thanks.
 

Mick

Member
This is my theory: 1280x720 and 1266x768 do not share the exact same aspect ratio. So when the viewport is automatically drawn to the screen, it will be scaled and centred. Because the aspect ratios of the viewport and are almost identical, the viewport will be drawn with a minimal x-offset of one pixel to make it centered.

You can handle the drawing of the viewport (application surface) manually also, giving you full control. I have set up my screen draw system to use the full resolution of any monitor and then draw the applicaction surface manually at the correct position and size, with either pixel perfect scaling or max possible scale to fit either the width or height of the screen.
 

Redspark

Member
Thanks. I suspected it was something like that. Are there any recommended tutorials on handling resolution scaling? I read the blog post by Mike back in 2014. Is that still the best way to deal with it? Thanks.
 
Top