F
Freddie The Potato
Guest
Heya!
I've been trying to find a way to convert the application surface into a texture so I can use it in shaders.
However, any attempts to draw this surface texture result in the image being repeated into infinity.
This is an undesirable effect, as I want the surface to be drawn a single time without containing an instance of itself.
I am currently achieving this effect by creating a "screen grab" surface, then drawing the application surface into the screen grab surface during the post draw event.
Here is the code from the tests:
Post Draw Event:
Draw Event:
If there are different or more efficient means of achieving this effect, please let me know.
I would really appreciate the help Thank you.
I've been trying to find a way to convert the application surface into a texture so I can use it in shaders.
However, any attempts to draw this surface texture result in the image being repeated into infinity.
This is an undesirable effect, as I want the surface to be drawn a single time without containing an instance of itself.
I am currently achieving this effect by creating a "screen grab" surface, then drawing the application surface into the screen grab surface during the post draw event.
Here is the code from the tests:
Post Draw Event:
Code:
{
if (surface_exists(global.screenGrab)) {
surface_set_target(global.screenGrab);
if (surface_exists(application_surface)) {
draw_clear(c_black);
draw_surface(application_surface, 0, 0);
}
surface_reset_target();
}
}
Code:
var
_tex = surface_get_texture(global.screenGrab);
draw_primitive_begin_texture(pr_trianglestrip, _tex);
draw_vertex_texture(x1, y1, 0, 0);
draw_vertex_texture(x2, y1, 1, 0);
draw_vertex_texture(x1, y2, 0, 1);
draw_vertex_texture(x2, y2, 1, 1);
draw_primitive_end();
I would really appreciate the help Thank you.