30 SSBO(
unsigned int size);
67 :size(size), target(-1), isInit(true)
69 glGenBuffers(1, &handle);
70 glBindBuffer(GL_SHADER_STORAGE_BUFFER, handle);
71 std::cout << handle <<
'\n';
72 glBufferData(GL_SHADER_STORAGE_BUFFER, size*
sizeof(T), NULL, GL_DYNAMIC_DRAW);
73 glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
81 std::cout <<
"Deleted SSBO with handle: " << handle <<
'\n';
82 glDeleteBuffers(1, &handle);
94 glBindBuffer(GL_SHADER_STORAGE_BUFFER, handle);
95 glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, data.size() *
sizeof(T), data.data());
96 glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0);
102 if (this->target != target)
104 glBindBufferBase(GL_SHADER_STORAGE_BUFFER, target, handle);
105 this->target = target;
112 glDeleteBuffers(1, &handle);
Wrapper for SSBO buffer (shader storage buffer object) T is the type of the data (struct and has to s...
Definition: SSBO.h:12
void uploadData(const std::vector< T > &data)
Definition: SSBO.h:92
void bindToTarget(unsigned int target)
Definition: SSBO.h:100
SSBO()
Definition: SSBO.h:61
unsigned int getCapacity()
Definition: SSBO.h:86
void release()
Definition: SSBO.h:110