Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. // C++ code
  2. glGenBuffers(1, &ProteinSphereBatchInfos);
  3. glBindBuffer(GL_SHADER_STORAGE_BUFFER, ProteinSphereBatchInfos);
  4. sz = 10000 * sizeof(QVector4D); // allocate something big enough, even if the space is wasted, this needs to be solved
  5. //if more than 10000 vectors are appended into the buffer
  6. glBufferData(GL_SHADER_STORAGE_BUFFER, sz, NULL, GL_DYNAMIC_DRAW);
  7.  
  8. glGenBuffers(1, &IndexAtomicCounter);
  9. glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, IndexAtomicCounter);
  10. glBufferData(GL_ATOMIC_COUNTER_BUFFER, sizeof(GLuint), NULL, GL_DYNAMIC_DRAW);
  11. glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0);
  12.  
  13. // binding before shader usage
  14. glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 5, this->ProteinSphereBatchInfos);
  15. glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 6, this->IndexAtomicCounter);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement