diff options
| author | Aaditya Dhruv <[email protected]> | 2026-01-25 15:10:37 -0600 |
|---|---|---|
| committer | Aaditya Dhruv <[email protected]> | 2026-01-25 15:10:37 -0600 |
| commit | 118980e02e59ff31871df59dce257075394f3533 (patch) | |
| tree | 26fba4492bb4b561d21bf49b35d892a821d54fab /src/util.c | |
| parent | 0e6e1245b70df4dfcba135d50e1b53d1a8ef7eb8 (diff) | |
wip
Diffstat (limited to 'src/util.c')
| -rw-r--r-- | src/util.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..0a5d983 --- /dev/null +++ b/src/util.c @@ -0,0 +1,24 @@ +#include "util.h" + +void create_vbo(GLuint *vbo, void* buf, int size) { + //tell opengl we want mem for 1 buffer object + glGenBuffers(1, vbo); + // set aray_buffer to above + glBindBuffer(GL_ARRAY_BUFFER, *vbo); + // copy vertex data to gpu memory + glBufferData(GL_ARRAY_BUFFER, size, buf, GL_STATIC_DRAW); + // cleanup + glBindBuffer(GL_ARRAY_BUFFER, 0); +} + +void create_ebo(GLuint *ebo, void* buf, int size) { + //tell opengl we want mem for 1 buffer object + glGenBuffers(1, ebo); + // set aray_buffer to above + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, *ebo); + // copy vertex data to gpu memory + glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, buf, GL_STATIC_DRAW); + // cleanup + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); +} + |
