Working through primitive buffering

This commit is contained in:
2021-03-02 16:20:03 +11:00
parent 97390122c9
commit 34a855b0b8
2 changed files with 117 additions and 0 deletions

View File

@ -0,0 +1,33 @@
#pragma once
#include <stdint.h>
#include <glad/glad.h>
#define PRIMITIVE_POSITIONS_PER_VERTICE 3
#define PRIMITIVE_COORDINATES_PER_VERTICE 2
typedef struct {
int32_t verticeCount;
GLuint vertexArray;
GLuint vertexBuffer;
GLuint indexBuffer;
} primitive_t;
typedef struct {
float x, y, z;
float u, v;
} vertice_t;
primitive_t * primitiveCreate(int32_t verticeCount);
void primitiveBufferVertices(primitive_t *primitive,
int32_t position, int32_t count, vertice_t *vertices
);
void primitiveBufferIndices(primitive_t *primitive,
int32_t position, int32_t count, int32_t *indices
);
void primitiveDraw(primitive_t *primitive, int32_t start, int32_t count);
void primitiveDispose(primitive_t *primitive);