commit 6492171e76c309e68106874221846dabddf5408a
parent 03b5f78560dca3f9c98cdf0578657cb1e278c7e9
Author: William Casarin <jb55@jb55.com>
Date: Tue, 23 Oct 2018 19:36:52 -0700
ocd
Diffstat:
M | src/geometry.c | | | 76 | ++++++++++++++++++++++++++++++++++++++-------------------------------------- |
1 file changed, 38 insertions(+), 38 deletions(-)
diff --git a/src/geometry.c b/src/geometry.c
@@ -5,52 +5,52 @@
void
destroy_buffer_geometry(struct geometry *geom) {
- gpu_addr buffers[] = {
- geom->buffer.vertex_buffer.handle,
- geom->buffer.normal_buffer.handle,
- geom->buffer.index_buffer.handle
- };
- /* void glDeleteVertexArrays(GLsizei n, const GLuint *arrays); */
- /* glDisableVertexAttribArray(geom->buffer.vertex_buffer.handle); */
- /* check_gl(); */
- /* glDisableVertexAttribArray(geom->buffer.normal_buffer.handle); */
- /* check_gl(); */
- /* glDisableVertexAttribArray(geom->buffer.index_buffer.handle); */
- /* check_gl(); */
- check_gl();
- glDeleteBuffers(ARRAY_SIZE(buffers), buffers);
- check_gl();
+ gpu_addr buffers[] = {
+ geom->buffer.vertex_buffer.handle,
+ geom->buffer.normal_buffer.handle,
+ geom->buffer.index_buffer.handle
+ };
+ /* void glDeleteVertexArrays(GLsizei n, const GLuint *arrays); */
+ /* glDisableVertexAttribArray(geom->buffer.vertex_buffer.handle); */
+ /* check_gl(); */
+ /* glDisableVertexAttribArray(geom->buffer.normal_buffer.handle); */
+ /* check_gl(); */
+ /* glDisableVertexAttribArray(geom->buffer.index_buffer.handle); */
+ /* check_gl(); */
+ check_gl();
+ glDeleteBuffers(ARRAY_SIZE(buffers), buffers);
+ check_gl();
}
void
make_buffer_geometry(struct geometry *geom) {
- // VBOs
+ // VBOs
- assert(geom->vertices);
- assert(geom->normals);
- assert(geom->indices);
- assert(geom->num_indices >= 1);
+ assert(geom->vertices);
+ assert(geom->normals);
+ assert(geom->indices);
+ assert(geom->num_indices >= 1);
- /* printf("making vertex buffer\n"); */
- make_vertex_buffer(
- GL_ARRAY_BUFFER,
- geom->vertices,
- geom->num_verts * 3 * (int)sizeof(*geom->vertices),
- &geom->buffer.vertex_buffer
- );
+ /* printf("making vertex buffer\n"); */
+ make_vertex_buffer(
+ GL_ARRAY_BUFFER,
+ geom->vertices,
+ geom->num_verts * 3 * (int)sizeof(*geom->vertices),
+ &geom->buffer.vertex_buffer
+ );
- /* printf("making normal buffer\n"); */
- // cube normals
- make_vertex_buffer(
- GL_ARRAY_BUFFER,
- geom->normals,
- geom->num_verts * 3 * (int)sizeof(*geom->normals),
- &geom->buffer.normal_buffer
- );
+ /* printf("making normal buffer\n"); */
+ // cube normals
+ make_vertex_buffer(
+ GL_ARRAY_BUFFER,
+ geom->normals,
+ geom->num_verts * 3 * (int)sizeof(*geom->normals),
+ &geom->buffer.normal_buffer
+ );
- /* printf("making index buffer\n"); */
- // cube indices
- make_index_buffer(
+ /* printf("making index buffer\n"); */
+ // cube indices
+ make_index_buffer(
GL_ELEMENT_ARRAY_BUFFER,
geom->indices,
geom->num_indices * (int)sizeof(*geom->indices),