diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-10-23 01:39:57 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-10-23 01:39:57 +0200 |
commit | 898b8c95f1f904307c02e978b57301cf1cb0560f (patch) | |
tree | d0bf51298967533ffb3ca6565ee309948820cf3f /src/graphics/primitive_type.c | |
parent | df2e6771c5bf6f09e62f9d6b86d83a2631ea365f (diff) |
Allow rendering vertices directly
Diffstat (limited to 'src/graphics/primitive_type.c')
-rw-r--r-- | src/graphics/primitive_type.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/graphics/primitive_type.c b/src/graphics/primitive_type.c new file mode 100644 index 0000000..c970a33 --- /dev/null +++ b/src/graphics/primitive_type.c @@ -0,0 +1,17 @@ +#include "../../include/mgl/graphics/primitive_type.h" +#include "../../include/mgl/gl_macro.h" + +unsigned int mgl_primitive_type_to_gl_mode(mgl_primitive_type primitive_type) { + switch(primitive_type) { + case MGL_PRIMITIVE_POINTS: return GL_POINTS; + case MGL_PRIMITIVE_LINES: return GL_LINES; + case MGL_PRIMITIVE_LINE_STRIP: return GL_LINE_STRIP; + case MGL_PRIMITIVE_TRIANGLES: return GL_TRIANGLES; + case MGL_PRIMITIVE_TRIANGLE_STRIP: return GL_TRIANGLE_STRIP; + case MGL_PRIMITIVE_TRIANGLE_FAN: return GL_TRIANGLE_FAN; + case MGL_PRIMITIVE_QUADS: return GL_QUADS; + case MGL_PRIMITIVE_QUAD_STRIP: return GL_QUAD_STRIP; + case MGL_PRIMITIVE_POLYGON: return GL_POLYGON; + } + return 0; +} |