GameMaker Studio 2 doesn't actually render most things to the screen directly, but instead it renders them to the application surface. This is essentially a surface, just like any that you can make yourself using the surface functions, and as such can be manipulated with the surface functions, drawn to, sent to shaders and anything else that you would normally do with surface are also applicable to this.
When you run your game, this surface is created the first time that
the draw event is called in each new room that you enter, which
means that nothing is drawn until that point. However, you can
still get the application surface position and resize it in the
CreateEvent or any other event without getting any errors
and the values used will be relevant to the surface when it is
created. The actual sequence of events is as follows:
- Pre-draw event
--- > application surface created and render target set
- For each visible view, or, if no views are active, once
Draw begin event--- > the application surface target is reset here
Draw event
Draw end event
- Post draw event
--- > the application surface is now drawn to the back buffer by default (although you can switch this off)
- Draw GUI begin event
- Draw GUI event
- Draw GUI end event
The use of this surface means that you can easily create incredible transitions using shaders, or take the screen and wrap it around a 3D form, or simply scale a low-res game up to any resolution screen... The possibilities are endless!
To access this surface, you need to use the built-in global variable application_surface which is explained on the following page:
You also have a couple of specialist functions that are designed only for use with the application surface: