PDA

View Full Version : [SOLVED]VAOs and conditions/loops (if, for)



jonathandup
04-06-2010, 11:44 AM
Hi,
I'm wondering if the kind of code below is valid and will work in a VAO (Vertex Array Object), I've searched the internet and haven't been able to find an answer :


bind VAO
bind VBO(+IBO)
for(GLuint i = 0; i<5; ++i)
EnableVertexAttribArray(i) + SetVertexAttribPtr(i);
end VAO


Now since VAOs are supposed to replace Display lists my guess is that it should work, but if I could have confirmation, it would help a lot.
Regards,

Rosario Leonardi
04-06-2010, 12:05 PM
Yes, they work in this way.
They don't work with condition.
If you do something like that


param = false
bind VAO
if(param)
bind(VBO1)
ese
bind(VBO2)
setup VAO
end VAO
//----some where in your code----
param = true
bind VAO // this will use the VBO binded at VAO creation not VBO1
draw