PDA

View Full Version : use the same vao to draw all objects



aiskyline
11-21-2015, 03:05 PM
Hi,

Can we use the same VAO and program to draw all objects ( if we have the same attributes location ) ?

or we have to generate and bind a VAO for every object we need to draw ?


Thanks.

carsten neumann
11-21-2015, 03:19 PM
You can use a single VAO and use glVertexAttribPointer (or glBindVertexBuffer on sufficiently new versions) calls before drawing to change which buffer provides the actual vertex data.
Since use of VAO became mandatory on core contexts one scheme to upgrade older code is to create and bind a single VAO during application initialization and otherwise ignore VAOs.

aiskyline
11-21-2015, 04:34 PM
ok, thank you :).