Legacy GM Shader interfering with interactivity?

Focksbot

Member
I'm trying to get caught up on shaders really fast, so there's a lot I don't really understand yet. I'm mixing together a few tutorials to get the result I want, which is basically a full screen gaussian blur on all of my text and objects.

I'm using a tutorial shader that works fine in the tutorial when applied to a specific background sprite.

I have an obj_shader with this in the create event:

Code:
application_surface_draw_enable(false);
usize = shader_get_uniform(shader,"size");//uniform for width, height, radius
I then have a post-draw event with this:

Code:
shader_set(shader)
shader_set_uniform_f(usize,room_width,room_height,8)//width,height,radius
draw_surface(application_surface,0,0)
shader_reset()
This achieves the aesthetic effect I'm after, but I can no longer click on the objects in the game, which I can do if I remove obj_shader from the room.

Can anyone explain how I can implement this shader without interfering with interactivity?
 

Focksbot

Member
Just to add a further detail to this, I've added a toggle to the shader so I can bring it in and out. When I activate it, the interactive elements of the game remain for a few moments before shutting down.

I've reading up as much as I can but can't even begin to understand why this should happen.
 

Focksbot

Member
Well, I have identified the problem but not solved the issue.

The problem is that the shader isn't drawing the application surface in the right location.

I have tried using this code:

Code:
var int_position = application_get_position();
draw_surface_ext(application_surface,int_position[0],int_position[1],(int_position[2]-int_position[0])/room_width,(int_position[3]-int_position[1])/room_height,0,-1,1);
This works as long as the viewport isn't resized, but if it's resized it draws the whole game right-aligned instead of in the center.
 

rytan451

Member
Instead of disabling the application surface, perhaps consider something like this:

Code:
shader_set(shader);
surface_set_taget(application_surface);
draw_surface(application_surface, 0, 0);
surface_reset_target();
shader_reset();
 
Top