aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-24 20:20:57 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-24 20:20:57 +0200
commit5cc09d9389243791f8f65f96a4d19a74337f2a73 (patch)
treea44372d5381983bd631b8e88c55cb6647abe78e7 /include
parent1a1ce3f6733b524122bdfe33e4b662803a698163 (diff)
add vec3 and vec4 and shader uniform functions for those
Diffstat (limited to 'include')
-rw-r--r--include/mgl/gl.h3
-rw-r--r--include/mgl/graphics/shader.h2
-rw-r--r--include/mgl/system/vec.h16
3 files changed, 20 insertions, 1 deletions
diff --git a/include/mgl/gl.h b/include/mgl/gl.h
index c1059b6..2537d96 100644
--- a/include/mgl/gl.h
+++ b/include/mgl/gl.h
@@ -33,7 +33,6 @@ typedef struct {
void (*glTexSubImage2D)(unsigned int target, int level, int xoffset, int yoffset, int width, int height, unsigned int format, unsigned int type, const void *pixels);
void (*glBindTexture)(unsigned int target, unsigned int texture);
void (*glTexParameteri)(unsigned int target, unsigned int pname, int param);
- void (*glHint)(unsigned int target, unsigned int mode);
void (*glBegin)(unsigned int mode);
void (*glEnd)(void);
void (*glVertex3f)(float x, float y, float z);
@@ -73,6 +72,8 @@ typedef struct {
int (*glGetUniformLocation)(unsigned int program, const char *name);
void (*glUniform1f)(int location, float v0);
void (*glUniform2f)(int location, float v0, float v1);
+ void (*glUniform3f)(int location, float v0, float v1, float v2);
+ void (*glUniform4f)(int location, float v0, float v1, float v2, float v3);
unsigned int (*glGetError)(void);
const unsigned char* (*glGetString)(unsigned int name);
void (*glGetIntegerv)(unsigned int pname, int *params);
diff --git a/include/mgl/graphics/shader.h b/include/mgl/graphics/shader.h
index daf8ac3..16b573a 100644
--- a/include/mgl/graphics/shader.h
+++ b/include/mgl/graphics/shader.h
@@ -24,6 +24,8 @@ int mgl_shader_program_finalize(mgl_shader_program *self);
int mgl_shader_program_set_uniform_float(mgl_shader_program *self, const char *uniform_name, float value);
int mgl_shader_program_set_uniform_vec2f(mgl_shader_program *self, const char *uniform_name, mgl_vec2f value);
+int mgl_shader_program_set_uniform_vec3f(mgl_shader_program *self, const char *uniform_name, mgl_vec3f value);
+int mgl_shader_program_set_uniform_vec4f(mgl_shader_program *self, const char *uniform_name, mgl_vec4f value);
/* If |shader_program| is NULL then no shader is used */
void mgl_shader_program_use(mgl_shader_program *shader_program);
diff --git a/include/mgl/system/vec.h b/include/mgl/system/vec.h
index 8b87376..444efcf 100644
--- a/include/mgl/system/vec.h
+++ b/include/mgl/system/vec.h
@@ -6,7 +6,23 @@ typedef struct {
} mgl_vec2f;
typedef struct {
+ float x, y, z;
+} mgl_vec3f;
+
+typedef struct {
+ float x, y, z, w;
+} mgl_vec4f;
+
+typedef struct {
int x, y;
} mgl_vec2i;
+typedef struct {
+ int x, y, z;
+} mgl_vec3i;
+
+typedef struct {
+ int x, y, z, w;
+} mgl_vec4i;
+
#endif /* MGL_VEC_H */