aboutsummaryrefslogtreecommitdiff
path: root/examples/simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/simple.c')
-rw-r--r--examples/simple.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/examples/simple.c b/examples/simple.c
index 68308c7f..c4cd731b 100644
--- a/examples/simple.c
+++ b/examples/simple.c
@@ -62,14 +62,21 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
sample->dec = inc;
}
- wlr_output_attach_render(wlr_output, NULL);
-
- struct wlr_renderer *renderer = sample->renderer;
- wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height);
- wlr_renderer_clear(renderer, sample->color);
- wlr_renderer_end(renderer);
-
- wlr_output_commit(wlr_output);
+ struct wlr_output_state state = {0};
+ struct wlr_render_pass *pass = wlr_output_begin_render_pass(wlr_output, &state, NULL);
+ wlr_render_pass_add_rect(pass, &(struct wlr_render_rect_options){
+ .box = { .width = wlr_output->width, .height = wlr_output->height },
+ .color = {
+ .r = sample->color[0],
+ .g = sample->color[1],
+ .b = sample->color[2],
+ .a = sample->color[3],
+ },
+ });
+ wlr_render_pass_submit(pass);
+
+ wlr_output_commit_state(wlr_output, &state);
+ wlr_output_state_finish(&state);
sample->last_frame = now;
}