summaryrefslogtreecommitdiff
path: root/src/daw.c
diff options
context:
space:
mode:
authoronelin <oscar@nelin.dk>2025-12-17 12:48:51 +0000
committeronelin <oscar@nelin.dk>2025-12-18 21:14:22 +0000
commit99d49b59e99cc94d18efd3ff0e33a25d7356bae9 (patch)
treed60fdcdf59c7f75307b6f57c3ac8734999425971 /src/daw.c
parent261d33c72095a2abd98177f88ebb24fe205a042f (diff)
Add framebuffer resizing
Diffstat (limited to 'src/daw.c')
-rw-r--r--src/daw.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/daw.c b/src/daw.c
index 79b230c..2659f3b 100644
--- a/src/daw.c
+++ b/src/daw.c
@@ -248,17 +248,17 @@ i32 engine_run(Instance* p, StateType initial_state, void* state_arg) {
ivec2 wsz;
window_get_size(&wsz);
u32 t[] = {
- BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_texture), BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_FMT_RGB8),
+ BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_texture), BUFFERPARAMETER_FMT_RGB8),
// The depth buffer could also be a texture like so:
// BUFFERPARAMETER_SET_PARAMETER(
// BUFFERPARAMETER_SET_TYPE(0, BufferType_texture),
- // BUFFERPARAMETER_TEXTURE_2D | BUFFERPARAMETER_FMT_DEPTH32
+ // BUFFERPARAMETER_FMT_DEPTH32
// ),
- BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_render), BUFFERPARAMETER_RENDERBUFFER_DEPTH | BUFFERPARAMETER_FMT_DEPTH32F),
+ BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_render), BUFFERPARAMETER_FMT_DEPTH32F),
};
FramebufferParameters p[] = {
- {.num_attached_buffers = sizeof(t) / sizeof(t[0]), .dimensions = {wsz[0], wsz[1], 0}},
+ {.num_textures = 1, .num_renderbuffers = 1, .dimensions = {wsz[0], wsz[1], 0}},
};
window_init_renderstack(w, 1, sizeof(t) / sizeof(t[0]), p, t);
//w->render_targets->cam[0] = &default_renderbuffer_camera;
@@ -342,13 +342,22 @@ i32 engine_run(Instance* p, StateType initial_state, void* state_arg) {
// Create only 1 additional framebuffer, in addition to the default
// one. This is used to render a texture that is represented as a quad
// on the default framebuffer.
- FramebufferParameters fb_params[] = {
- {.num_attached_buffers = 1, {200,200}},
- };
+ ivec2 wsz;
+ window_get_size(&wsz);
u32 t[] = {
- BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_texture), BUFFERPARAMETER_TEXTURE_2D)
+ BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_texture), BUFFERPARAMETER_FMT_RGB8),
+
+ // The depth buffer could also be a texture like so:
+ // BUFFERPARAMETER_SET_PARAMETER(
+ // BUFFERPARAMETER_SET_TYPE(0, BufferType_texture),
+ // BUFFERPARAMETER_FMT_DEPTH32
+ // ),
+ BUFFERPARAMETER_SET_PARAMETER(BUFFERPARAMETER_SET_TYPE(0, BufferType_render), BUFFERPARAMETER_FMT_DEPTH32F),
+ };
+ FramebufferParameters p[] = {
+ {.num_textures = 1, .num_renderbuffers = 1, .dimensions = {wsz[0], wsz[1], 0}},
};
- window_init_renderstack(w, 1, 1, fb_params, t);
+ window_init_renderstack(w, 1, sizeof(t) / sizeof(t[0]), p, t);
//w->render_targets->cam[0] = &default_camera;
}