Original Post
I'm about to implement mesh rendering into my engine, to draw players, units etc in the game. I know that the best way is to batch everything into effects (shaders), then textures, then vertex buffers, but my graphics engine currently just calls a draw function for each registered object (such as the heightmap, then each entity). It does support batching by object type, so the render loop looks like this: Loop for each object type (e.g. heightmap, one type of mesh, another type of mesh) --- Call pre-batch drawing function (can be used to set things like shaders and textures for the current mesh) --- Loop for each instance of the object and draw it (e.g. each enemy of a certain type) --- Call post-batch drawing function (can be used to clean up temporary objects etc) Does this sound like a good way of doing things, or maybe anyone could suggest some way to adapt this in order to perform better.