GML Problem with drawing layers in the "Draw End" event

B

Bipp

Guest
Hi !

The problem i have is that drawing the application surface or any surface for that matter in the Draw End event results in just a black screen. Everything that is drawn in the Draw GUI event still shows up though.

Drawing regular sprites in Draw End works fine too.
I just use this:
Code:
draw_surface(application_surface, view_xview, view_yview);
It draws the surface perfectly fine in any other draw event but in Draw End it results in just a black screen.

Im postprocessing by mixing together several surfaces so i need to make sure all the instances draw calls are completed before i mix them.

To avoid unwanted offsets i've stayed away from the Draw GUI event since it doesn't account for scaling the sprites used for the lighting when increasing/decreasing the view_wview and view_hview variables.

That leaves the Draw End event to do the mixing. Looking at the documentation, i can't understand why the surface would show up black. I can't find any answers to this online either.

I use Game Maker Studio 1.4 (v.1.4.1804)

TLDR;
Surfaces drawn in the Draw End event results in black screen with the stuff in Draw GUI on top of the black screen, how to fix?. Thanks in advance!
 

JasonTomLee

Member
You need to draw the app surface in the Draw GUI Event! I forget the specific reason why but the GUi event is basically independant from the view port. So you should always draw the app surface on Draw GUI when you disable it.

Try ordering the objects in different Layers or depths to organize the Draw GUI events. Or you can place them all in one object & have them controlled via 'switch statement'. That's what i do to handle a bunch of post-processing effects.
 

NightFrost

Member
You can also use Post Draw event. Render target switches from app surface to back buffer at the beginning of post draw, and the automatic app surface draw to back buffer (if you leave it on) happens immediately after post draw.
 
M

Mitchell H

Guest
Are you able to draw a object on a surface?

Don't matter the depth and or layers I try,
cant seem to block out the light with the lighting code. I know the surface is draw over the room.
 

dialgpalkia

Member
I am not sure if I am exactly right, but think of a surface as a piece of transparent material. You can draw sprites on that material. You cannot put objects ON the material. From my understanding, you draw the sprite of the object and then use a point_in_rectangle the covers the sprite that you have drawn, and then use your object code in that.
I may be wrong but that's how I use it. I tried to draw objects on the GUI for ages before I figured this out.
 
Top