aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/font.c8
-rw-r--r--src/graphics/image.c4
-rw-r--r--src/graphics/shader.c24
-rw-r--r--src/graphics/texture.c2
4 files changed, 19 insertions, 19 deletions
diff --git a/src/graphics/font.c b/src/graphics/font.c
index 9a99f22..4fd9840 100644
--- a/src/graphics/font.c
+++ b/src/graphics/font.c
@@ -39,13 +39,13 @@ int mgl_font_load_from_file(mgl_font *self, const mgl_memory_mapped_file *mapped
self->font_info = malloc(sizeof(stbtt_fontinfo));
if(!self->font_info) {
- fprintf(stderr, "Error: failed to load font, error: out of memory\n");
+ fprintf(stderr, "mgl error: failed to load font, error: out of memory\n");
return -1;
}
/* TODO: Handle font offset with ttc */
if(!stbtt_InitFont(self->font_info, mapped_file->data, stbtt_GetFontOffsetForIndex(mapped_file->data, 0))) {
- fprintf(stderr, "Error: failed to load font, error: stbtt_InitFont failed\n");
+ fprintf(stderr, "mgl error: failed to load font, error: stbtt_InitFont failed\n");
mgl_font_unload(self);
return -1;
}
@@ -137,7 +137,7 @@ static void mgl_font_handle_new_render_position(mgl_font *self, int glyph_width)
mgl_font_char_iterator_next(&font_char_it);
}
} else {
- fprintf(stderr, "Error: failed to resize font atlas\n");
+ fprintf(stderr, "mgl error: failed to resize font atlas\n");
}
} else if(self->font_atlas.render_section == MGL_ATLAS_SECTION_RIGHT && self->font_atlas.pointer_position.y + self->current_line_max_height + (int)self->character_size + GLYPH_PADDING >= self->font_atlas.prev_height) {
self->font_atlas.right_section_height = self->font_atlas.pointer_position.y + self->current_line_max_height;
@@ -174,7 +174,7 @@ int mgl_font_get_glyph(mgl_font *self, uint32_t codepoint, mgl_font_glyph *glyph
if(mgl_texture_load_from_memory(&self->texture, NULL, initial_atlas_size, initial_atlas_size, MGL_IMAGE_FORMAT_ALPHA, &load_options) != 0) {
return -1;
} else {
- /*fprintf(stderr, "Error: failed to create font atlas texture, error: mgl_texture_load_from_memory failed\n");*/
+ /*fprintf(stderr, "mgl error: failed to create font atlas texture, error: mgl_texture_load_from_memory failed\n");*/
self->font_atlas.width = initial_atlas_size;
self->font_atlas.height = initial_atlas_size;
}
diff --git a/src/graphics/image.c b/src/graphics/image.c
index eeee2ad..bb11334 100644
--- a/src/graphics/image.c
+++ b/src/graphics/image.c
@@ -46,7 +46,7 @@ int mgl_image_load_from_file(mgl_image *self, const char *filepath) {
int format;
self->data = stbi_load(filepath, &self->width, &self->height, &format, 0);
if(!self->data) {
- fprintf(stderr, "Error: failed to load image %s, error: %s\n", filepath, stbi_failure_reason());
+ fprintf(stderr, "mgl error: failed to load image %s, error: %s\n", filepath, stbi_failure_reason());
mgl_image_unload(self);
return -1;
}
@@ -65,7 +65,7 @@ int mgl_image_load_from_memory(mgl_image *self, const unsigned char *data, size_
int format;
self->data = stbi_load_from_memory(data, size, &self->width, &self->height, &format, 0);
if(!self->data) {
- fprintf(stderr, "Error: failed to load image from memory, error: %s\n", stbi_failure_reason());
+ fprintf(stderr, "mgl error: failed to load image from memory, error: %s\n", stbi_failure_reason());
mgl_image_unload(self);
return -1;
}
diff --git a/src/graphics/shader.c b/src/graphics/shader.c
index 8f44f0f..83c8407 100644
--- a/src/graphics/shader.c
+++ b/src/graphics/shader.c
@@ -25,7 +25,7 @@ static void print_compile_log(mgl_context *context, unsigned int shader_id, cons
if(log_length > 0) {
char *log_str = malloc(log_length + 1);
if(!log_str) {
- fprintf(stderr, "Error: failed to allocate memory for shader compile log\n");
+ fprintf(stderr, "mgl error: failed to allocate memory for shader compile log\n");
return;
}
@@ -47,7 +47,7 @@ static int mgl_shader_load_from_memory(mgl_shader *self, const unsigned char *sh
mgl_context *context = mgl_get_context();
self->id = context->gl.glCreateShader(mgl_shader_type_to_gl_shader_type(shader_type));
if(self->id == 0) {
- fprintf(stderr, "Error: failed to load shader, error: glCreateShader failed\n");
+ fprintf(stderr, "mgl error: failed to load shader, error: glCreateShader failed\n");
return -1;
}
@@ -57,12 +57,12 @@ static int mgl_shader_load_from_memory(mgl_shader *self, const unsigned char *sh
int compiled_successfully = GL_FALSE;
context->gl.glGetShaderiv(self->id, GL_COMPILE_STATUS, &compiled_successfully);
if(compiled_successfully == GL_FALSE) {
- print_compile_log(context, self->id, "Error");
+ print_compile_log(context, self->id, "mgl error");
mgl_shader_unload(self);
return -1;
}
- print_compile_log(context, self->id, "Warning");
+ print_compile_log(context, self->id, "mgl warning");
return 0;
}
@@ -72,12 +72,12 @@ static int mgl_shader_load_from_file(mgl_shader *self, const char *filepath, mgl
mgl_filedata filedata;
if(mgl_load_file(filepath, &filedata, NULL) != 0) {
- fprintf(stderr, "Error: failed to load shader %s, error: mgl_load_file failed\n", filepath);
+ fprintf(stderr, "mgl error: failed to load shader %s, error: mgl_load_file failed\n", filepath);
return -1;
}
if(filedata.size > INT32_MAX) {
- fprintf(stderr, "Error: failed to load shader %s, error: shader size is too large\n", filepath);
+ fprintf(stderr, "mgl error: failed to load shader %s, error: shader size is too large\n", filepath);
return -1;
}
@@ -100,7 +100,7 @@ int mgl_shader_program_init(mgl_shader_program *self) {
mgl_context *context = mgl_get_context();
self->id = context->gl.glCreateProgram();
if(self->id == 0) {
- fprintf(stderr, "Error: failed to create shader program: error glCreateProgram failed\n");
+ fprintf(stderr, "mgl error: failed to create shader program: error glCreateProgram failed\n");
return -1;
}
@@ -143,7 +143,7 @@ static void print_link_log(mgl_context *context, unsigned int shader_id, const c
if(log_length > 0) {
char *log_str = malloc(log_length + 1);
if(!log_str) {
- fprintf(stderr, "Error: failed to allocate memory for shader link log\n");
+ fprintf(stderr, "mgl error: failed to allocate memory for shader link log\n");
return;
}
@@ -163,11 +163,11 @@ int mgl_shader_program_finalize(mgl_shader_program *self) {
int is_linked = GL_TRUE;
context->gl.glGetProgramiv(self->id, GL_LINK_STATUS, &is_linked);
if(is_linked == GL_FALSE) {
- print_link_log(context, self->id, "Error");
+ print_link_log(context, self->id, "mgl error");
return -1;
}
- print_link_log(context, self->id, "Warning");
+ print_link_log(context, self->id, "mgl warning");
return 0;
}
@@ -179,7 +179,7 @@ int mgl_shader_program_set_uniform_float(mgl_shader_program *self, const char *u
mgl_context *context = mgl_get_context();
int uniform_location = context->gl.glGetUniformLocation(self->id, uniform_name);
if(uniform_location == -1) {
- fprintf(stderr, "Error: no uniform by the name %s was found in the shader\n", uniform_name);
+ fprintf(stderr, "mgl error: no uniform by the name %s was found in the shader\n", uniform_name);
return -1;
}
@@ -193,7 +193,7 @@ int mgl_shader_program_set_uniform_vec2f(mgl_shader_program *self, const char *u
mgl_context *context = mgl_get_context();
int uniform_location = context->gl.glGetUniformLocation(self->id, uniform_name);
if(uniform_location == -1) {
- fprintf(stderr, "Error: no uniform by the name %s was found in the shader\n", uniform_name);
+ fprintf(stderr, "mgl error: no uniform by the name %s was found in the shader\n", uniform_name);
return -1;
}
diff --git a/src/graphics/texture.c b/src/graphics/texture.c
index fb8c1e5..128d910 100644
--- a/src/graphics/texture.c
+++ b/src/graphics/texture.c
@@ -63,7 +63,7 @@ int mgl_texture_init(mgl_texture *self) {
mgl_context *context = mgl_get_context();
context->gl.glGenTextures(1, &self->id);
if(self->id == 0) {
- fprintf(stderr, "Error: failed to init texture (glGenTextures failed)\n");
+ fprintf(stderr, "mgl error: failed to init texture (glGenTextures failed)\n");
return -1;
}