Remove pointer index, fix memoery leak in glyph

This commit is contained in:
SamratGhale
2026-03-29 06:34:00 +05:45
parent c1b64e9066
commit 06664f9f67
5 changed files with 47 additions and 57 deletions
+2 -2
View File
@@ -126,7 +126,7 @@ glyph_draw_font :: proc(glyph_state: ^GlyphState, text: string, pos : [2]f32, co
text_color: [4]f32 = {f32( color.r)/ 255.0 ,f32(color.g)/255.0, f32(color.b)/255.0, f32(color.a)/255.0}
glyph_state.rect_buffer = make([dynamic]GlyphRectInstance, 0, 1000)
//glyph_state.rect_buffer = make([dynamic]GlyphRectInstance, 0, 1000)
{
//put every glyph in text into rect_buffer
@@ -147,7 +147,6 @@ glyph_draw_font :: proc(glyph_state: ^GlyphState, text: string, pos : [2]f32, co
prev_codepoint: rune = 0
delete(glyph_state.rect_buffer)
glyph_state.rect_buffer = make([dynamic]GlyphRectInstance, 0, 1000)
glyph_state.curr = pos
glyph_state.curr.y += math.round(baseline)
@@ -329,4 +328,5 @@ glyph_draw_font :: proc(glyph_state: ^GlyphState, text: string, pos : [2]f32, co
gl.InvalidateBufferData(glyph_state.rect_instances_vbo)
}
delete(glyph_state.rect_buffer)
}