summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gl.c1
-rw-r--r--src/include/daw/rendering.h12
-rw-r--r--src/rendering.c1
3 files changed, 9 insertions, 5 deletions
diff --git a/src/gl.c b/src/gl.c
index 9dce5e5..8283a3e 100644
--- a/src/gl.c
+++ b/src/gl.c
@@ -244,6 +244,7 @@ RenderObject RenderObject_new(
o.buffer = buffers;
o.buffer_len = num_buffers;
o.mvp = gl->GetUniformLocation(o.shader.program, "MVP");
+ o.model_position = gl->GetUniformLocation(o.shader.program, "modelPosition");
// It is very much a non-issue if we don't find the model view projection in
// the shader. In fact, it is removed from a shader program if it is not used.
diff --git a/src/include/daw/rendering.h b/src/include/daw/rendering.h
index 0da97f5..9f53f78 100644
--- a/src/include/daw/rendering.h
+++ b/src/include/daw/rendering.h
@@ -130,15 +130,11 @@ typedef struct {
}
typedef struct {
- /* Shader proram */
+ /* Shader program */
Shader shader;
/* Vertex Array Object */
u32 vao;
- /* MVP (a uniform from the shader).
- * This could also probably be generalized */
- i32 mvp;
-
// The texture ID, glBindTextures(target, &this->texture)
u32 texture;
@@ -147,6 +143,12 @@ typedef struct {
// The vertex buffer is also just a buffer
ShaderBuffer* buffer;
+
+ // Uniforms
+ /* MVP (a uniform for the shader).
+ * This could also probably be generalized */
+ i32 mvp;
+ i32 model_position;
} RenderObject;
typedef struct {
diff --git a/src/rendering.c b/src/rendering.c
index 54dc7b4..4db3308 100644
--- a/src/rendering.c
+++ b/src/rendering.c
@@ -492,6 +492,7 @@ void render_present(Window* w) {
// TODO: Do this only once during initialization
gl->UniformMatrix4fv(o->mvp, 1, GL_FALSE, &modelviewprojection[0][0]);
+ gl->UniformMatrix4fv(o->model_position, 1, GL_FALSE, &model[0][0]);
}
// TODO the buffers need to be abstracted a bit more