Commit 3a31ac92 by Philipp Adolf

Increase size of output vertex buffer

parent 5212054f
......@@ -723,10 +723,12 @@ Subdivision::Result Subdivision::runShader(Input input, Tables &tables) {
f->glBufferData(GL_SHADER_STORAGE_BUFFER, tables.edge_indices.size() * sizeof(GLuint), tables.edge_indices.data(), GL_DYNAMIC_DRAW);
// Create an output buffer
// the new vertex buffer contains the old vertices + the new edge vertices + the modified non-edge vertices
unsigned int output_size = input.vertex_buffer.size() + tables.edge_indices.size() / 4 + (tables.vertex_offsets.size() - 1);
GLuint output_handle;
f->glGenBuffers(1, &output_handle);
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, output_handle);
f->glBufferData(GL_SHADER_STORAGE_BUFFER, (input.vertex_buffer.size() + tables.edge_indices.size() / 4) * sizeof(Vertex), NULL, GL_DYNAMIC_DRAW);
f->glBufferData(GL_SHADER_STORAGE_BUFFER, output_size * sizeof(Vertex), NULL, GL_DYNAMIC_DRAW);
result.vb_handle = output_handle;
f->glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment