summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rendering.cc6
-rw-r--r--src/rendering.h2
-rw-r--r--src/wayclock.cc12
3 files changed, 11 insertions, 9 deletions
diff --git a/src/rendering.cc b/src/rendering.cc
index e12026a..356c6b3 100644
--- a/src/rendering.cc
+++ b/src/rendering.cc
@@ -101,9 +101,9 @@ bool wayc_atlas_init(atlas_s* atlas, u32 width, u32 height) {
return true;
}
-void wayc_atlas_use(atlas_s atlas, u32 slot) {
- wayc_image_use(atlas.texture, slot);
- wayc_sampler_use(atlas.sampler, slot);
+void wayc_atlas_use(atlas_s* atlas, u32 slot) {
+ wayc_image_use(atlas->texture, slot);
+ wayc_sampler_use(atlas->sampler, slot);
}
void wayc_atlas_deinit(atlas_s* atlas) {
diff --git a/src/rendering.h b/src/rendering.h
index 7609b8a..b70d366 100644
--- a/src/rendering.h
+++ b/src/rendering.h
@@ -60,5 +60,5 @@ struct atlas_s {
};
bool wayc_atlas_init(atlas_s* atlas, u32 width, u32 height);
-void wayc_atlas_use(atlas_s atlas, u32 slot);
+void wayc_atlas_use(atlas_s* atlas, u32 slot);
void wayc_atlas_deinit(atlas_s* atlas);
diff --git a/src/wayclock.cc b/src/wayclock.cc
index e8879f4..43f07ab 100644
--- a/src/wayclock.cc
+++ b/src/wayclock.cc
@@ -22,16 +22,16 @@ struct app_s {
struct atlas_s* atlas;
};
-void wayc_frame(struct renderer_s* renderer, struct window_s* window,
+void wayc_frame(struct app_s* app, struct window_s* window,
struct eventloop_s* loop) {
wayc_notnull(window);
wayc_notnull(loop);
- wayc_notnull(renderer);
+ wayc_notnull(app);
- glClearColor(0.1f, 0.2f, 0.2f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
+ wayc_atlas_use(app->atlas, 0);
- wayc_renderer_swap(renderer);
+ wayc_renderer_swap(app->renderer);
}
void wayc_handle(u8* user, struct eventloop_s* loop, struct event_s* event) {
@@ -53,7 +53,7 @@ void wayc_handle(u8* user, struct eventloop_s* loop, struct event_s* event) {
wayc_renderer_resize(renderer, resize.width, resize.height);
} break;
case EVENT_KIND_FRAME:
- wayc_frame(renderer, window, loop);
+ wayc_frame(app, window, loop);
break;
default:
break;
@@ -103,7 +103,9 @@ int main() {
wayc_panic("Failed to initialize renderer");
wayc_defer(wayc_renderer_deinit(&renderer));
+
wayc_renderer_use(&renderer);
+ glClearColor(0.1f, 0.2f, 0.2f, 1.0f);
struct atlas_s atlas;
if (!wayc_atlas_init(&atlas, WAYC_ATLAS_WIDTH, WAYC_ATLAS_HEIGHT))