--- a/src/glcontext.c Mon Apr 21 17:27:33 2025 +0200 +++ b/src/glcontext.c Mon Apr 21 17:52:01 2025 +0200 @@ -50,9 +50,9 @@ static int asc_primitives_init(AscGLContext *context) { asc_dprintf("Create primitives for the GL context of active window."); - asc_mesh_allocate_buffers((AscMesh*)&context->primitives, sizeof(context->primitives) / sizeof(AscMesh)); + asc_mesh_allocate_buffers(context->primitives, ASC_PRIMITIVE_COUNT); - asc_primitives_init_plane(&context->primitives.plane); + asc_primitives_init_plane(&context->primitives[ASC_PRIMITIVE_PLANE_IDX]); // TODO: more primitives return asc_error_catch_all_gl(); @@ -75,8 +75,8 @@ } static int asc_texture_initialize_predefined(AscGLContext *ctx) { - asc_texture_init_rectangle(&ctx->textures.empty_1x1_rect, 1); - asc_texture_init_2d(&ctx->textures.empty_1x1_2d, 1); + asc_texture_init_rectangle(ctx->textures_rect, ASC_TEXTURE_RECT_COUNT); + asc_texture_init_2d(ctx->textures_2d, ASC_TEXTURE_2D_COUNT); // Create a 1x1 surface with 32-bit RGBA format SDL_Surface* white1x1 = SDL_CreateRGBSurface( @@ -91,15 +91,15 @@ SDL_FillRect(white1x1, NULL, 0xFFFFFFFF); // Initialize the empty textures with the white surface - asc_texture_from_surface(&ctx->textures.empty_1x1_2d, white1x1); - asc_texture_from_surface(&ctx->textures.empty_1x1_rect, white1x1); + asc_texture_from_surface(&ctx->textures_rect[ASC_TEXTURE_RECT_EMPTY_1X1_IDX], white1x1); + asc_texture_from_surface(&ctx->textures_2d[ASC_TEXTURE_2D_EMPTY_1X1_IDX], white1x1); return asc_error_catch_all_gl(); } static void asc_texture_destroy_predefined(AscGLContext *ctx) { - asc_texture_destroy(&ctx->textures.empty_1x1_2d, 1); - asc_texture_destroy(&ctx->textures.empty_1x1_rect, 1); + asc_texture_destroy(ctx->textures_rect, ASC_TEXTURE_RECT_COUNT); + asc_texture_destroy(ctx->textures_2d, ASC_TEXTURE_2D_COUNT); } bool asc_gl_context_initialize(