I am learning and programming with LWJGL/OpenGL. I want to render my map in chunks. For this I create a VAO and VBO for each chunk and upload and link them.
The problem is, that if I render the first chunk, all of the following 3 chunks will be rendered on top of that. If I render the second chunk the following 2 chunks will be rendered on top.
This is the log of my application, describing how I setup my VAOs:
Chunk: 0 0
Generate VBO: 1
Generate VAO: 1
Bind VAO: 1
Bind VBO: 1
Enable and set VertexAttribPointer
Bufferdata (Buffersize: 36864)
Bind VAO: 0
Chunk: 0 1
Generate VBO: 2
Generate VAO: 2
Bind VAO: 2
Bind VBO: 2
Enable and set VertexAttribPointer
Bufferdata (Buffersize: 1536)
Bind VAO: 0
Chunk: 1 0
Generate VBO: 3
Generate VAO: 3
Bind VAO: 3
Bind VBO: 3
Enable and set VertexAttribPointer
Bufferdata (Buffersize: 1536)
Bind VAO: 0
Chunk: 1 1
Generate VBO: 4
Generate VAO: 4
Bind VAO: 4
Bind VBO: 4
Enable and set VertexAttribPointer
Bufferdata (Buffersize: 64)
Bind VAO: 0
Draw
Bind VAO: 1
Set Unifoms
Draw Arrays
The buffersizes are as expected.
For binding I use glBindVertexArray() and glBindBuffer(GL_ARRAY_BUFFER, )
For drawing I use glDrawArrays()
Is the way I setup my VAOs wrong, or do you need my code to solve my problem?