terrain

Real-time terrain generation using marching cubes
git clone git://git.christianermann.dev/terrain
Log | Files | Refs | README | LICENSE

commit 3c142b5842da7e856ae0ce20b2cb72802b79b5bc
parent 05ddec083c167aacbdbb8304fcb4ac554bd6b89b
Author: Christian Ermann <christianermann@gmail.com>
Date:   Wed, 17 Nov 2021 17:37:04 -0800

Removed unused files.

Diffstat:
Dinclude/glh/buffer.h | 16----------------
Dsrc/buffer.c | 53-----------------------------------------------------
2 files changed, 0 insertions(+), 69 deletions(-)

diff --git a/include/glh/buffer.h b/include/glh/buffer.h @@ -1,16 +0,0 @@ -#ifndef GLH_BUFFER_H -#define GLH_BUFFER_H - -#include "glad/glad.h" -#include <stdlib.h> - -// Create a vertex buffer of 'size' bytes filled with the data at 'first' -GLuint createVertexBuffer(size_t size, GLfloat* first, GLenum mode); - -// Create an index buffer of 'size' bytes filled with the data 'first' -GLuint createIndexBuffer(size_t size, GLuint* first, GLenum mode); - -GLuint createVertexArray(GLuint vertex_buffer, GLuint index_buffer, - int attribute_count, int* attribute_sizes); - -#endif diff --git a/src/buffer.c b/src/buffer.c @@ -1,53 +0,0 @@ -#include "glh/buffer.h" - -GLuint createVertexBuffer(size_t size, GLfloat* first, GLenum mode) -{ - GLuint vertex_buffer; - glGenBuffers(1, &vertex_buffer); - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - glBufferData(GL_ARRAY_BUFFER, size, first, mode); - glBindBuffer(GL_ARRAY_BUFFER, 0); - return vertex_buffer; -} - -GLuint createIndexBuffer(size_t size, GLuint* first, GLenum mode) -{ - GLuint index_buffer; - glGenBuffers(1, &index_buffer); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer); - glBufferData(GL_ELEMENT_ARRAY_BUFFER, size, first, mode); - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); - return index_buffer; -} - -GLuint createVertexArray(GLuint vertex_buffer, GLuint index_buffer, - int attribute_count, int* attribute_sizes) -{ - GLuint vertex_array; - glGenVertexArrays(1, &vertex_array); - glBindVertexArray(vertex_array); - - glBindBuffer(GL_ARRAY_BUFFER, vertex_buffer); - - size_t vertex_size = 0; - for (int i = 0; i < attribute_count; i++) - { - vertex_size += attribute_sizes[i]; - } - vertex_size *= sizeof(GLfloat); - - size_t offset = 0; - for (int i = 0; i < attribute_count; i++) - { - glVertexAttribPointer(i, attribute_sizes[i], GL_FLOAT, GL_FALSE, - vertex_size, (GLvoid*)offset); - glEnableVertexAttribArray(i); - offset += attribute_sizes[i] * sizeof(GLfloat); - } - - glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_buffer); - - glBindVertexArray(0); - - return vertex_array; -}