1function rendertarget()
2-- default pipeline existing both in world and scaled RTs
3	local orw = VRESW;
4	local orh = VRESH;
5	resize_video_canvas(VRESW * 0.5, VRESH * 0.5);
6	local a = color_surface(64, 64, 255, 0, 0);
7	local b = color_surface(64, 64, 0, 255, 0);
8	local c = color_surface(64, 64, 0, 64,255);
9	move_image(b, 0, VRESH * 0.5 - 64);
10	move_image(c, 0, VRESH - 64);
11	show_image({a, b, c});
12	nudge_image(a, VRESW - 64, 0, 100, INTERP_EXPINOUT);
13	nudge_image(b, VRESW - 64, 0, 100, INTERP_SINE);
14	nudge_image(c, VRESW - 64, 0, 100, INTERP_EXPIN);
15	nudge_image(a, -1 * (VRESW - 64), 0, 100, INTP_EXPOUT);
16	nudge_image(b, -1 * (VRESW - 64), 0, 100, INTERP_LINEAR);
17	nudge_image(c, -1 * (VRESW - 64), 0, 100, INTERP_SINE);
18	image_transform_cycle(a, true);
19	image_transform_cycle(b, true);
20	image_transform_cycle(c, true);
21
22	rt1 = alloc_surface(VRESW, VRESH);
23	rt2 = alloc_surface(VRESW, VRESH);
24	rt3 = alloc_surface(VRESW, VRESH);
25
26	show_image({rt1, rt2, rt3});
27
28	define_rendertarget(rt1, {a, b, c},
29		RENDERTARGET_NODETACH, RENDERTARGET_SCALE, 0);
30	define_rendertarget(rt2, {a, b, c},
31		RENDERTARGET_NODETACH, RENDERTARGET_SCALE, -1);
32	define_rendertarget(rt3, {a, b, c},
33		RENDERTARGET_NODETACH, RENDERTARGET_SCALE, 1);
34
35	resize_video_canvas(orw, orh);
36
37	move_image(rt1, VRESW - image_surface_properties(rt1).width, 0);
38	move_image(rt2, VRESW - image_surface_properties(rt2).width,
39		VRESH - image_surface_properties(rt2).height);
40	move_image(rt3, 0, VRESH - image_surface_properties(rt3).height);
41
42	d = color_surface(64, 64, 255, 255, 255);
43	show_image(d);
44
45-- scaled being updated on a tick basis 'manually'
46-- normal being updated on a tick basis automatically
47	push_video_context();
48	pop_video_context();
49end
50
51local in_world = true;
52function rendertarget_preframe_pulse()
53	if (in_world) then
54		in_world = false;
55		rendertarget_attach(rt3, d, RENDERTARGET_DETACH);
56	else
57		in_world = true;
58		rendertarget_attach(rt2, d, RENDERTARGET_DETACH);
59	end
60end
61
62function rendertarget_clock_pulse()
63	if (0 == CLOCK % 2) then
64		rendertarget_forceupdate(rt1);
65	end
66end
67