• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED I can't seem to be able to remove part of a surface...

GML:
gpu_set_blendmode(bm_subtract);
if room == rm_village {
    draw_rectangle_color(3434,3520,3551,3567,c_white,c_white,c_white,c_white,0);
}
Hello.
I'm drawing to a surface (ingame water reflection) which reflects instances onto the surface. There's certain pixels I don't want to be reflective and the above code to remove pixels from that surface just isn't working.
I've tried changing the draw colour to c_black instead of c_white, I also tried draw_rectangle() without "color" but I have a feeling it's not erasing because I have draw_sprite_ext() for all the reflections in the same event (before the erasing of course).
I've considered draw_sprite_part() route instead of trying to erase anything but that draws parts of sprites rectangularly and that's not exactly what I'm after.

Incase I created any confusion there, here's the order...
draw event:
surface_set_target();
draw_clear();
gpu_set_blendmode();
draw_sprite_ext() (for every instance with independent image_blend.
draw_sprite() (looped for all other instances)
then erasing with
gpu_set_blendmode(bm_subtract);
draw_rectangle();
shader_reset();
surface_reset_target();
draw_surface();

The surface is remade each draw event, so I have a feeling draw_sprite() functions will override any bm_subtract draws even if they're afterwards in the draw event. I'm not entirely certain how drawing surfaces works beneath the code however.
I hope that isn't the case. Is what I'm trying to achieve impossible?
 
Last edited:

gnysek

Member
What is size of your surface? From those numbers it seems it's bigger than 4K!

Remember, that surface coordinates aren't equal to room coordinates. Maybe you want to subtract view x and y offset before drawing?
 
What is size of your surface? From those numbers it seems it's bigger than 4K!

Remember, that surface coordinates aren't equal to room coordinates. Maybe you want to subtract view x and y offset before drawing?
Perfect - thank you so much! That was exactly the issue. I forgot to tailor the xy to the camera xy.
GML:
draw_rectangle(3434-view_x,3520-view_y,3551-view_x,3567-view_y,0);

Thanks again :)
 
Top