From 6b94f0dbdeeeeb22e0ebf7a09554ce040a2fc9eb Mon Sep 17 00:00:00 2001 From: Patrick Cleavelin Date: Wed, 20 Mar 2024 17:36:18 -0500 Subject: [PATCH] haha, init the arrays first --- src/main.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 47b0ef7..d5a384e 100644 --- a/src/main.c +++ b/src/main.c @@ -89,6 +89,11 @@ void ed_init(_gfx_frame_func frame_func) { // NOTE: the order of these matter gfx_push_vertex_buffer(state.gfx_cx, vertices, sizeof(vertices)); gfx_push_vertex_buffer(state.gfx_cx, indices, sizeof(indices)); + + state.gpu_ui_rects = newArray(GpuUiRect, 2000); + state.gpu_glyphs = newArray(GpuGlyph, 1024); + state.glyph_cache = newArray(GpuGlyph, 97); + gfx_allocate_vertex_buffer(state.gfx_cx, state.gpu_glyphs.capacity * sizeof(GpuGlyph)); gfx_allocate_vertex_buffer(state.gfx_cx, sizeof(GpuUniformParams)); @@ -109,10 +114,6 @@ void ed_init(_gfx_frame_func frame_func) { const int rasterized_font_height = 64; uint8_t *font_bitmap = context_alloc(font_bitmap_size*font_bitmap_size * sizeof(uint8_t)); - state.gpu_ui_rects = newArray(GpuUiRect, 2000); - state.gpu_glyphs = newArray(GpuGlyph, 1024); - state.glyph_cache = newArray(GpuGlyph, 97); - int ascent, descent, line_gap; float scale = stbtt_ScaleForPixelHeight(&font, rasterized_font_height); stbtt_GetFontVMetrics(&font, &ascent, &descent, &line_gap);