src/glcontext.c

changeset 78
9bc544f4ce8f
parent 77
2187a732f4d7
--- a/src/glcontext.c	Tue Mar 18 22:43:31 2025 +0100
+++ b/src/glcontext.c	Wed Mar 19 22:43:37 2025 +0100
@@ -48,13 +48,21 @@
     cx_strfree(&buf);
 }
 
-#include "shader_codes.h"
-
 static void asc_shader_initialize_predefined(AscGLContext *ctx) {
+    // TODO: deal with different working dirs
     AscShaderSprite *sprite = &ctx->shader.sprite;
-    sprite->program = asc_shader_program_create(asc_shader_codes_sprite);
+    AscShaderCodes codes;
+    if (asc_shader_load_code_files((AscShaderCodeFiles){
+        .vtx = "./shader/sprite_vtx.glsl",
+        .frag = "./shader/sprite_frag.glsl"
+    }, &codes)) {
+        asc_error("Loading sprite shader failed.");
+        return;
+    }
+    sprite->program = asc_shader_program_create(codes);
     sprite->depth = glGetUniformLocation(sprite->program.id, "depth");
     sprite->tex = glGetUniformLocation(sprite->program.id, "texture");
+    asc_shader_free_codes(codes);
 }
 
 static void asc_shader_destroy_predefined(AscGLContext *ctx) {

mercurial