Solved bug where we mistakenly bounded VAOs before EBOs and VBOs
This commit is contained in:
parent
01993a93ed
commit
7d05cb46b3
1 changed files with 2 additions and 2 deletions
4
main.c
4
main.c
|
|
@ -129,7 +129,6 @@ int main()
|
|||
// VAO setup
|
||||
glGenVertexArrays(1, &hex->vao);
|
||||
glBindVertexArray(hex->vao);
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3*sizeof(float), (void*)0);
|
||||
|
||||
// VBO setup
|
||||
float *vertices = hex->vertices;
|
||||
|
|
@ -162,6 +161,7 @@ int main()
|
|||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, hex->ebo);
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, 6*3 * sizeof(unsigned int), indices, GL_STATIC_DRAW);
|
||||
|
||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
|
||||
glEnableVertexAttribArray(0);
|
||||
}
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ int main()
|
|||
for (size_t i = 0; i < grid.rows * grid.columns; ++i)
|
||||
{
|
||||
glBindVertexArray(grid.hexes[i].vao);
|
||||
log_debug("Binding VAO %d VBO %d EBO %d", grid.hexes[i].vao, grid.hexes[i].vbo, grid.hexes[i].ebo);
|
||||
//log_debug("Binding VAO %d VBO %d EBO %d", grid.hexes[i].vao, grid.hexes[i].vbo, grid.hexes[i].ebo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, grid.hexes[i].vbo);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, grid.hexes[i].ebo);
|
||||
glDrawElements(GL_TRIANGLES, 3*6, GL_UNSIGNED_INT, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue