|
@@ -182,10 +182,18 @@ void VBO::unmap()
|
|
is_bound = true;
|
|
is_bound = true;
|
|
}
|
|
}
|
|
|
|
|
|
- // "orphan" current buffer to avoid implicit synchronisation on the GPU:
|
|
|
|
- // http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
|
|
|
|
- glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), NULL, getUsage());
|
|
|
|
- glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), memory_map, getUsage());
|
|
|
|
|
|
+ if (getUsage() == GL_STATIC_DRAW)
|
|
|
|
+ {
|
|
|
|
+ // Upload the mapped data to the buffer.
|
|
|
|
+ glBufferSubDataARB(getTarget(), 0, (GLsizeiptr) getSize(), memory_map);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ // "orphan" current buffer to avoid implicit synchronisation on the GPU:
|
|
|
|
+ // http://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
|
|
|
|
+ glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), NULL, getUsage());
|
|
|
|
+ glBufferDataARB(getTarget(), (GLsizeiptr) getSize(), memory_map, getUsage());
|
|
|
|
+ }
|
|
|
|
|
|
is_mapped = false;
|
|
is_mapped = false;
|
|
}
|
|
}
|