Search code examples
openglopengl-esglsltexturesvao

Does it make sense to connect a texture to a VAO?


When I have different vertex attribute configurations bound to a VAO I can easily change the VAO and render different things. But those different things might need different textures too. Does it makes sense to bind textures to VAO too so that when you change the VAO the same texture index is populated with different data?


Solution

  • A VAO is essentially a table of all values passed into glVertexAttribPointer() as well as a reference to the VBO that was bound at the time when glEnableVertexAttribArray() was called. There is no way to connect a texture to a particular VBO, and you will have to do this yourself manually prior to rendering your VAO.