Skip to content

Commit

Permalink
GRAPHICS: Add updateGLBound method to VertexBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
mirv-sillyfish authored and DrMcCoy committed Nov 17, 2018
1 parent 5ce37f9 commit 679e4d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/graphics/vertexbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ void VertexBuffer::updateGL() {
}
}

void VertexBuffer::updateGLBound() const {
glBufferSubData(GL_ARRAY_BUFFER, 0, _count * _size, _data);
}

void VertexBuffer::destroyGL() {
if (_vbo != 0) {
glDeleteBuffers(1, &_vbo);
Expand Down
3 changes: 3 additions & 0 deletions src/graphics/vertexbuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ class VertexBuffer {
/** Update existing GL buffer object. Try not to call while rendering. */
void updateGL();

/** Update an existing GL buffer object, assuming it is already bound. */
void updateGLBound() const;

/** Clear (destroy) GL resources associated with the buffer. */
void destroyGL();

Expand Down

0 comments on commit 679e4d9

Please sign in to comment.