P
Paris Stalker
Guest
Hi all,
I know it's possible to create a surface in an object and then use the with() function to draw multiple other objects onto that surface whilst it's targeted, and have managed to use this successfully.
However, in an attempt to optimise my draw pipeline I was hoping I could do the following:
- Draw onto two surfaces within two objects
- Then draw those two surfaces onto another surface in a control object
But no matter which way I try to do this, all it ends up doing is just drawing the two surfaces as if I hadn't set the target to the new combined surface, implying that nothing is being drawn to the new surface. Due to the nature of how surfaces work, is it simply not possible to do this?
I have tried a lot of variations, but the first code I tried that is most comparable to the normal with() style is:
I know it's possible to create a surface in an object and then use the with() function to draw multiple other objects onto that surface whilst it's targeted, and have managed to use this successfully.
However, in an attempt to optimise my draw pipeline I was hoping I could do the following:
- Draw onto two surfaces within two objects
- Then draw those two surfaces onto another surface in a control object
But no matter which way I try to do this, all it ends up doing is just drawing the two surfaces as if I hadn't set the target to the new combined surface, implying that nothing is being drawn to the new surface. Due to the nature of how surfaces work, is it simply not possible to do this?
I have tried a lot of variations, but the first code I tried that is most comparable to the normal with() style is:
EDIT: If you're wondering why not just draw the objects straight onto the combined surface, I am using a shader with different inputs per each of the two starting object's surfaces, so if I drew them onto the same surface I could not have the different parts.// Players Scaled Up Surface
if (!surface_exists(player_scale_surf)) {player_scale_surf = surface_create(640,360);}
surface_set_target(player_scale_surf);
draw_clear_alpha(c_black,0);
with (obj_player)
{
if (surface_exists(surf))
{
draw_surface_ext(surf,0,0,1,1,0,c_white,1);
}
}
surface_reset_target();
//Draw Character Surface
better_scaling_draw_surface(player_scale_surf,0,0,3,3,0,c_white,1,3);
Last edited by a moderator: