PDA

View Full Version : Binding a vertex array



Cucus
06-15-2011, 08:35 AM
Hi

Here's my render function:


void Joint::render()
{
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);

this->changeCoordinates(); //don't care about this

glBindVertexArray(vao);

glDrawArrays(GL_TRIANGLES,0,sizeVertex/3);

if(hasLogo())
{
glBindVertexArray(vaoLogo);

glDrawArrays(GL_TRIANGLES,0,sizeVertexLogo/3);
}

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);

}


The point is when hasLogo() is true. In this case, the first DrawArrays doesn't draw anything, do you know why?

Dan Bartlett
06-15-2011, 09:23 AM
These lines:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
Affect the currently bound VAO, so you either should remove those lines + put them in the code that constructs vao + vaoLogo, or only use them after you have bound the VAO.

Cucus
06-15-2011, 09:31 AM
Ok, thanks!