0% found this document useful (0 votes)
53 views1 page

C++ - Do I Need To Call glEnableVertexAttribArray If I Use VAOs - Stack Overflow

The document discusses whether glEnableVertexAttribArray needs to be called when using VAOs. It explains that VAOs can store bindings to VBOs and index buffers, and that glEnableVertexAttribArray does not need to be called again during rendering since it should have already been enabled during VAO setup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

C++ - Do I Need To Call glEnableVertexAttribArray If I Use VAOs - Stack Overflow

The document discusses whether glEnableVertexAttribArray needs to be called when using VAOs. It explains that VAOs can store bindings to VBOs and index buffers, and that glEnableVertexAttribArray does not need to be called again during rendering since it should have already been enabled during VAO setup.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Do I need to call glEnableVertexAttribArray if I use VAOs?

Asked 6 years, 11 months ago Modified 6 years, 11 months ago Viewed 270 times

I understood that VAOs can store bindings to VBOs and index VBOs (both GL_ARRAY_BUFFER and
GL_ELEMENT_ARRAY_BUFFER ), but now I have a question:

-1
void render()
{
..Set up textures, uniforms..

glBindVertexArray(vaoId)); // This also binds VBOs and indices VBOs


automatically (if it was properly set up)

glEnableVertexAttribArray(0); // Do I need this?


glEnableVertexAttribArray(1); // Do I need this?
glEnableVertexAttribArray(2); // Do I need this?

glDrawElements(GL_TRIANGLES, indices_N, GL_UNSIGNED_BYTE, 0);

.. cleanup..
}

Do I still need to call glEnableVertexAttribArray even if I already bound a VAO properly set up?

c++ opengl graphics vbo vao

Share Improve this question Follow asked May 5, 2017 at 12:34


Dean
6,838 6 42 95

See this answer, it should sort the things out for you. – Yakov Galka May 5, 2017 at 16:02

1 Answer Sorted by: Highest score (default)

This is not necessary. You should have already called glEnableVertexAttribArray during the VAO
setup so they get enabled automatically when the VAO gets bound.
2
Share Improve this answer Follow answered May 5, 2017 at 13:06
BDL
21.7k 27 53 59

You might also like