I created a shader storage buffer object to give information to my vertex shader. It is bound to a buffer containing a single structure. But there is a problem. The data I keep in this structure is not a simple array, it's a std::vector
.
Here is the structure :
typedef struct {
glm::mat4 modelMatrix;
} entityInfo;
typedef struct {
std::vector<entityInfo> entityInfoBuffer;
} shaderData;
mat4 is just a simple 4x4 float matrix.
If I give this to OpenGL, the data transmitted to the GPU will be just a bunch of pointers and info about the matrix/vector, and not the data in them.
One solution would be to create a structure only for OpenGL:
typedef struct {
float* modelMatrix;
} SSBOentityInfo;
typedef struct {
SSBOentityInfo* entityInfoBuffer;
} SSBOshaderData;
But I would have to copy eeeeevery pointer corresponding to the data of the containers.
Is there a better way to do it?