inertias
Member
Hey everyone, so I was looking at this tutorial to make a lighting system:
I got it working, but am having an issue with the fps dropping dramatically.
Only spawning one light cuts my fps in half (60 down to 30). Here is the code:
2 objects, 1 called obj_surface_light and obj_lightsource
in obj_surface_light:
create event
step event
the obj_lightsource just has x_radius and y_radius set to 2 in the create event.
So yeah, was wondering if anyone can spot where there are performance issues with this. Thanks!
Only spawning one light cuts my fps in half (60 down to 30). Here is the code:
2 objects, 1 called obj_surface_light and obj_lightsource
in obj_surface_light:
create event
Code:
depth = -100;
light_surf = surface_create(room_width, room_height);
Code:
if (surface_exists(light_surf))
{
surface_set_target(light_surf);
draw_clear(c_black);
with (obj_lightsource) //take control of light source object
{
gpu_set_blendmode (bm_zero);
draw_sprite_ext(spr_lightmap, 0, x, y, x_radius, y_radius, 0, c_black, 1);
gpu_set_blendmode(bm_zero);
draw_sprite_ext(spr_lightmap, 0, x, y, x_radius, y_radius, 0, c_orange, 0.1);
gpu_set_blendmode(bm_normal);
}
surface_reset_target();
draw_surface_ext(light_surf, 0, 0, 1, 1, 0, c_white, 0.8);
}
else {light_surf = surface_create(room_width, room_height)}
So yeah, was wondering if anyone can spot where there are performance issues with this. Thanks!