Hello all, I am attempting to make a 2D isometric tiling rendering algorithm. I am using z buffers, frustum culling and I am currently planning to use instancing to render the tiles (attempting to draw 256x256 individual quads resulted in 65536 updates 60 times per second, really bad idea).
I am currently learning about batching from:
I get the core idea. This question is about one misunderstanding of the said tutorial.
I am attempting to recreate the instancing code from the above tutorial. It is stated that:
“we only have to update a small buffer each frame (the center of the particles) and not a huge mesh. This is a x4 bandwidth gain!”.
So it meant 1 center position (4 GLfloats) for every particle instance. However I thought in OpenGL it is required to have 1 set of position per vertex? So if I am drawing a quad with 4 vertices (using EBO), I must then also provide 4 center values, not 1.
This could be confusion on my part, however in the code it states:
glBufferData(GL_ARRAY_BUFFER, MaxParticles * 4 * sizeof(GLfloat), NULL, GL_STREAM_DRAW);
This implies for every particle created, there will be exactly 4 GLfloats for it - namely x y z and the size. Is this possible? I thought of setting the stride to 0 but it simply tells OpenGL to find the stride itself from the tightly packed data.
If it’s possible to define a single quad with only the center position (3 GLfloats), that would be absolutely godsend.
Any help on this would be greatly appreciated.