Multiple VAO share a EBO (OpenGL 3.3) As mentioned here, multiple VAOs can share a single VBO. However, can multiple VAOs share a single EBO?

For example, I want to create 2 rectangles. So, I do the following:

const GLuint indices[6] = {
    0, 1, 2,
    0, 3, 2
};

// First
glGenVertexArrays (1, &amp;VAO1);
glBindVertexArray (VAO1);
glGenBuffers (1, &amp;EBO1);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, EBO1);
glBufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
// creating VBO, setting attributes etc
// Second
glGenVertexArrays (1, &amp;VAO2);
glBindVertexArray (VAO2);
glGenBuffers (1, &amp;EBO2);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, EBO2);
glBufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);


glBufferData(GL_ELEMENT_ARRAY_BUFFER) is called twice for different EBOs with same data. As I understand, this leads to double GPU memory consumption and takes twice loading time. 

So, would the following be correct?

const GLuint indices[6] = {
    0, 1, 2,
    0, 3, 2
};
glGenBuffers (1, &amp;EBO);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, EBO);
glBufferData (GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

// First
glGenVertexArrays (1, &amp;VAO1);
glBindVertexArray (VAO1);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, EBO);
// creating VBO, setting attributes etc
// Second
glGenVertexArrays (1, &amp;VAO2);
glBindVertexArray (VAO2);
glBindBuffer (GL_ELEMENT_ARRAY_BUFFER, EBO);
Your code is non-functional, but only because (in the core profile) you cannot bind a buffer to GL_ELEMENT_ARRAY_BUFFER unless a VAO is also bound. So the part that creates the buffer would need to use a different binding point, which is totally fine:

const GLuint indices[6] = {
    0, 1, 2,
    0, 3, 2
};
glGenBuffers (1, &amp;EBO);
glBindBuffer (GL_ARRAY_BUFFER, EBO);
glBufferData (GL_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);


Everything else is perfectly valid.