I have been developing a game engine using OpenGL 3 and C++ (and glfw for window management). I have advanced so far, got most of the things done except sound entities and optimizations. The engine uses deferred shading so since deferred shading is itself a tiring process for an average GPU, I want to optimize the rendering process as much as possible.
The current system consists of a Scene, containing a Renderer and the current World and the World holds entities and lighting entities as separate std::vectorsstd::vectors.
So basically every time the Scene gets called by ->render()->render(), and it calls the Renderer, passinng the world as a parameter and gets the entity iterators from the world, draws them to the FBO and then goes through the lighting entities for the second pass. And I think this is not enough. Surely at some point I have to iterate
My current algorithm iterates through everything but even if the entity is not in the screen space, it at least calls API functions. I am thinking of filling some kind of render list on each world->update()(which is FPS dependent) and go through that list on each scene->render()(FPS independent) but checking each entity to see if it is in that conic camera FOV 60 times per second seemed a bit costly to me. Or maybe not, since I can't make specifications clear in my head I can't start coding it. So I would be gladway to hear your ideas aboutoptimize the current rendering optimizations.algorithm so it only calls the API functions only for the visible objects, so what are the common techniques for optimizing such renderer ?