I recently worked through this tutorial about instanced rendering. At the end it promises to draw a huge amount of instances of one model without performance drops.
So I tried some simple instanced rendering to see these effects. So I created a VBO containing four times xyz-coordiantes, vertex color and texcoords.
float[] backgroundData = new float[] {
-1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 0.0f, 0.0f,
1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 0.0f, 0.0f,
-1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 1.0f, 0.0f,
1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 1.0f, 0.0f
};
I also created a VAO and EBO containing the glVertexAttribPointers
and indices int[] indices = new int[]{0,1,2,1,2,3};
.
Now I draw everything with glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0, 10_000)
. But the Framerate drops as much as if I had the indices 10.000 times in my EBO. Why is the outcome so different? Did I do something wrong?