Dynamically create and access multiple (Buffer)Objects in shader

Hi everyone,
I am creating an OpenGL program which will dynamically create BufferObjects and send them to the fragment shader. Those BufferObjects look like this:


struct Node{
    ... various variables... (uint, int, float)
};

struct BufferObject{
    .... various variables... (uint, int, float)
    int size_of_data;
    Node data[];
};


Each object will have a data[] of different size, so I cannot use a fixed size for data[], and I do not know from the start how many BufferObjects I will have (can be up to thousands of objects).

What is the best way to send those Objects to the fragment shader and accessing them all?

I was trying to create a buffer for each object. But I do not know how to access the buffers, i.e. lets say I know that I created 500 Objects and sent each to the shader in a buffer (GL_SHADER_STORAGE_BUFFER), how can i access object 456?

Thanks a lot for your help.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.