Is it possible to make 2D ssbo?

std::vector<std::vector<glm::vec4>> pixels(width, std::vector<glm::vec4>(height));

for (int i = 0; i < width; ++i) {
    for (int j = 0; j < height; ++j) {
        pixels[i][j] = glm::vec4(0.0f);
    }
}


GLuint pixels_SSBO;
glGenBuffers(1, &pixels_SSBO);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, pixels_SSBO);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(glm::vec4) * width * height, pixels.data(), GL_DYNAMIC_DRAW);

I get error in last line

Your pixels object does not store width * height consecutive glm::vec4 objects, but that is what glBufferData expects.
Instead pixels.data() points to width many std::vector<glm::vec4> objects, each of which contains a pointer to height many glm::vec4.
Use a single std::vector<glm::vec4> with size width * height instead.

Thank you,

I did it

GLuint pixels_SSBO;
glGenBuffers(1, &pixels_SSBO);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, pixels_SSBO);
glBufferData(GL_SHADER_STORAGE_BUFFER, sizeof(glm::vec4) * width * height, pixels.data(), GL_DYNAMIC_DRAW);

And now I want to get it inside of shader

#version 430 core

layout( local_size_x = 64, local_size_y =1, local_size_z = 1 ) in;

layout(std430, binding=0) buffer pixelsBuffer
{
vec4 pixels; // I tried specify dimensions here [800][600] but it’s doesn’t change anything
};

void main() {
uint i = gl_GlobalInvocationID.x;

if (i < 600) {  // I'm using 600 everywhere just to be sure what everything is ok
    for (int j = 0; j < 600; j++) {
        pixels[i][j] = vec4(0.5, 0.5, 0.5, 1);
    }
}

}

and I get Opengl error 1282 (invalid operation), here
glDispatchCompute(ceil(800 * 600 / 64), 1, 1);

But I get this error even if array is flatten