aboutsummaryrefslogtreecommitdiff
path: root/src/graphics/vertex.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-12-08 01:02:56 +0100
committerdec05eba <dec05eba@protonmail.com>2021-12-08 01:03:15 +0100
commitb7e3507a82d93b470d89f5cdf838f480bd7e4ab4 (patch)
treeac689868c0b0e6caa8a13038e2dd7f9b02e2ef50 /src/graphics/vertex.c
parent1739930d6f4b16eb5f3118412cddd20277ac5639 (diff)
Vertex translation, fix vertex texture use
Diffstat (limited to 'src/graphics/vertex.c')
-rw-r--r--src/graphics/vertex.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/graphics/vertex.c b/src/graphics/vertex.c
index 110c86d..8e9b5b9 100644
--- a/src/graphics/vertex.c
+++ b/src/graphics/vertex.c
@@ -1,16 +1,17 @@
#include "../../include/mgl/graphics/vertex.h"
#include "../../include/mgl/mgl.h"
-void mgl_vertices_draw(mgl_context *context, const mgl_vertex *vertices, size_t vertex_count, mgl_primitive_type primitive_type) {
+void mgl_vertices_draw(mgl_context *context, const mgl_vertex *vertices, size_t vertex_count, mgl_primitive_type primitive_type, mgl_vec2f position) {
if(vertex_count == 0)
return;
- context->gl.glMatrixMode(GL_TEXTURE);
- context->gl.glLoadIdentity();
- context->gl.glMatrixMode(GL_MODELVIEW);
+ context->gl.glPushMatrix();
+ context->gl.glTranslatef(position.x, position.y, 0.0f);
context->gl.glVertexPointer(2, GL_FLOAT, sizeof(mgl_vertex), (void*)&vertices[0].position);
context->gl.glTexCoordPointer(2, GL_FLOAT, sizeof(mgl_vertex), (void*)&vertices[0].texcoords);
context->gl.glColorPointer(4, GL_UNSIGNED_BYTE, sizeof(mgl_vertex), (void*)&vertices[0].color);
context->gl.glDrawArrays(mgl_primitive_type_to_gl_mode(primitive_type), 0, vertex_count);
+
+ context->gl.glPopMatrix();
}