I always wanted to implement modern OpenGL module similar to SFML Graphics module. I implemented the basic classes like camera2D, transform2D, mesh2D, AABB2D, font, text, texture, sprite and rectangleShape and few other classes for batch drawing like sprite_batch, rectangle_batch and debug2D_batch. All of them support instance drawing and render them with this command:
glDrawElements(GL_TRIANGLE_STRIP, mSize, GL_UNSIGNED_INT, 0);
for batch drawing i used this
glDrawElementsInstanced(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0, static_cast<GLsizei>(mInstanceData.size()));
Special case for Text class it draw all Glyphs with
glDrawElementsInstanced(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_INT, 0, static_cast<GLsizei>(mInstances.size()));
I tested it with SFML Game Development Book Game Engine. I made it to ch 7 still there are more to do.
The video shows the collision detection and debug shapes for BattlefieldBounds & ViewBounds and all game object's AABBs. i used two 2D camera for this result:
https://www.youtube.com/watch?v=HAYQxfWdv_4updated: i just found that SFML used batch drawing internally. excellent
