D
DanielBartley
Guest
Hey guys,
I'm an experience gm user since 6.1, and haven't touched gm in a few years.
i having some dramas with surfaces.
what I'm attempting to achieve is use a 'bloom' sprite to light up another sprite on the surface, and crop it so that it just leaves the 'bloomed' part of the image, which i will then draw.
As seen in the pic below, 1 is the original background, which would display completely if the bloom completely covered the image, 2 shows the actual bloom, and 3 the result I am after.
Any help would be highly appreciated.
Thanks
CODE:
if (!surface_exists(mask_surface)) {
mask_surface = surface_create(256, 256);
surface_set_target(mask_surface);
draw_clear(c_black);
gpu_set_blendmode(bm_subtract);
//draw_sprite(sprite2, 0, 128, 128);
draw_circle(128, 128, 70, false);
gpu_set_blendmode(bm_normal);
surface_reset_target();
}
if (!surface_exists(clip_surface)) {
clip_surface = surface_create(256, 256);
}
surface_set_target(clip_surface);
draw_clear_alpha(c_black, 0);
gpu_set_blendmode(bm_subtract);
draw_sprite_ext(sprite0, 0, 64, 64, 2, 2, 0, c_white, 1);
gpu_set_blendmode(bm_add);
draw_sprite(sprite2, 0, mouse_x - clipx - 32, mouse_y - clipy - 32);
//draw_circle(mouse_x - clipx, mouse_y - clipy, 40, false);
gpu_set_blendmode(bm_subtract);
draw_surface(mask_surface, 0, 0);
gpu_set_blendmode(bm_normal);
surface_reset_target();
draw_surface(clip_surface, clipx, clipy);
I'm an experience gm user since 6.1, and haven't touched gm in a few years.
i having some dramas with surfaces.
what I'm attempting to achieve is use a 'bloom' sprite to light up another sprite on the surface, and crop it so that it just leaves the 'bloomed' part of the image, which i will then draw.
As seen in the pic below, 1 is the original background, which would display completely if the bloom completely covered the image, 2 shows the actual bloom, and 3 the result I am after.
Any help would be highly appreciated.
Thanks
CODE:
if (!surface_exists(mask_surface)) {
mask_surface = surface_create(256, 256);
surface_set_target(mask_surface);
draw_clear(c_black);
gpu_set_blendmode(bm_subtract);
//draw_sprite(sprite2, 0, 128, 128);
draw_circle(128, 128, 70, false);
gpu_set_blendmode(bm_normal);
surface_reset_target();
}
if (!surface_exists(clip_surface)) {
clip_surface = surface_create(256, 256);
}
surface_set_target(clip_surface);
draw_clear_alpha(c_black, 0);
gpu_set_blendmode(bm_subtract);
draw_sprite_ext(sprite0, 0, 64, 64, 2, 2, 0, c_white, 1);
gpu_set_blendmode(bm_add);
draw_sprite(sprite2, 0, mouse_x - clipx - 32, mouse_y - clipy - 32);
//draw_circle(mouse_x - clipx, mouse_y - clipy, 40, false);
gpu_set_blendmode(bm_subtract);
draw_surface(mask_surface, 0, 0);
gpu_set_blendmode(bm_normal);
surface_reset_target();
draw_surface(clip_surface, clipx, clipy);
Attachments
-
8.5 KB Views: 3