Hi there, I’ve been trying to build a simple rendering engine on my own in the hope of learning more about graphics. Now I have two confusions.
To keep GL state change as few as possible, my idea now is that I render meshes that share the same material all together. But I don’t know whether I should keep an array of mesh pointer in each material or create a map with key as material pointer and mapped value as an array of mesh pointer. Or is there other better ways? how is it implemented commonly? what about the case where many objects share the same mesh?
I would like to use uniform buffer objects to store various constants for shaders to use, I know I can use one uniform buffer object per scene to store matrices like view and perspective, but I don’t know how many should I create for objects and materials, one for each? or few shared by them?