src/mesh.c

changeset 122
1b118cd3e369
parent 118
830608f7e7d9
--- a/src/mesh.c	Wed May 14 20:14:18 2025 +0200
+++ b/src/mesh.c	Fri May 16 07:54:02 2025 +0200
@@ -28,6 +28,8 @@
 #include "ascension/error.h"
 #include "ascension/mesh.h"
 
+#include <cx/allocator.h>
+
 #include <GL/glew.h>
 
 void asc_mesh_allocate_buffers(AscMesh *mesh, unsigned count) {
@@ -72,7 +74,7 @@
 
 void asc_mesh_destroy(AscMesh *mesh) {
     asc_mesh_free_buffers(mesh, 1);
-    free(mesh->vtx_data);
+    cxFreeDefault(mesh->vtx_data);
 }
 
 void asc_mesh_init_plane_2d(AscMesh *mesh, struct asc_mesh_init_plane_2d_args args) {
@@ -84,7 +86,7 @@
 
     // free any previous data
     if (mesh->vtx_data && mesh->vtx_data_size < required_memory) {
-        free(mesh->vtx_data);
+        cxFreeDefault(mesh->vtx_data);
         mesh->vtx_data = NULL;
     }
 
@@ -93,7 +95,7 @@
     if (mesh->vtx_data == NULL) {
         asc_dprintf("Create plane in VBO %u and VAO %u", mesh->vbo, mesh->vao);
         mesh->vtx_data_size = required_memory;
-        data = malloc(mesh->vtx_data_size);
+        data = cxMallocDefault(mesh->vtx_data_size);
         mesh->vtx_data = (float*) data;
     } else {
         data = (AscMeshVertex2d*) mesh->vtx_data;

mercurial