Created
February 24, 2016 10:41
-
-
Save ratchetfreak/3b1e5c1fdbfbc11223a3 to your computer and use it in GitHub Desktop.
syncing mapped buffers using flush
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//map buffer with GL_MAP_FLUSH_EXPLICIT_BIT | |
waitBuffer(gl4, rbWriteIndex); | |
perMeshPointer.position(rbAlignment * rbWriteIndex); | |
perMeshPointer.asFloatBuffer().put(perMesh[i].toFa()); | |
perMeshPointer.rewind(); | |
gl4.glFlushMappedBufferRange(GL_UNIFORM_BUFFER, rbAlignment * rbWriteIndex, rbAlignment); | |
gl4.glBindBufferRange(GL_UNIFORM_BUFFER, | |
Semantic.Uniform.PER_MESH, | |
bufferName.get(Buffer.PER_MESH), | |
rbAlignment * rbWriteIndex, | |
rbAlignment | |
); | |
/* do render*/ | |
lockBuffer(gl4, rbWriteIndex); | |
rbWriteIndex = (rbWriteIndex + 1) % rbMax; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment