Shaders Scaling application surface on fullscreen (while shader is active)

A

Ahlis

Guest
Hello!

I'm having a slight issue: I have a game that is 960x540 in size and a screen that is 1920x1080 (so double the size in both directions):
When going into fullscreen (without my shader) everything works flawlessly and the application_surface will become stretched and adjust to the screen. However, when I disable the automatic drawing of the application surface and apply my shader to it before drawing in post_draw: (becomes like the image below) (Notice how the GUI is still properly stretched)
Any ideas why the application surface does not become stretched? Thanks in advance
image_not_working.png
 

RangerX

Member
If you disable the automatic drawing of the application surface this means you need to handle it yourself!
If course it won't resize, center and draw correctly by itself since you disabled it.

What's your code related to all that?
 
A

Ahlis

Guest
Oh thank you, I'm a silly goose!
I didn't have any event to handle the Ctrl+Enter -> full screen. Found the condition as well: window_get_fullscreen() :)

The code was not really relevant, except using post_draw and a shader to draw the application surface manually.

My next question would be what kind of operations does the automatic drawing do when going into fullscreen. Like how does it rescale the window or surface to make it stretched?
 
Last edited by a moderator:
F

frumple

Guest
I think what you want is to draw the application surface yourself using:
Code:
draw_surface_stretched(index, x, y, w, h);
or one of the other draw_surface functions. Stretch it to your desired w and h and you're done.

You might need to clear it in Pre Draw as well using something like:
Code:
surface_set_target ( index );
draw_clear_alpha( c_black , 0 );
surface_reset_target();
 

RangerX

Member
My next question would be what kind of operations does the automatic drawing do when going into fullscreen. Like how does it rescale the window or surface to make it stretched?
Depends on the settings you have in the graphic section (global settings, under your target's tab)

Fullscale:
GameMaker will take the application surface (which normally is the size of the port on screen unless you resized it) and it will resize it the size of the monitor. (So yeah, you game will end up distorted and stretched).

Keep Aspect Ratio:
GameMaker will resize the application surface as big as possible but this time will keep the same aspect ratio. So basically, the game will not appear stretched but GameMaker won't care if it's scaled up "pixel perfect" or not. It just scales it as big as possible.
 
Top