I am trying to code a new feature in my engine but I can't find a way to implement my idea, which is the next one. I am trying to get multi pass rendering with more than two passes.

I know how to do a two pass rendering pipeline for effects like blurring and shadow mapping, but my problem is that now I want to make an undefined number of passes without having to have that number of different functions (a different one for every pass).

Do you have any ideas about what could I do here? I have thought about doing some kind of function pointer that is called x amount of times, each time calling to a different function, but again, I don't know what is the best (or the easiest) approach. Would love to hear your ideas and comments. Thanks!

PS, I am using openGL if that is useful information.


It is really hard to give a meaningful decision without in-depth knowledge of your game engine. I'll try to answer from what I know making my own game engine.

You could have many renderer (I call them painter in my engine) that are each associated with a rendering step. When you run your pipeline, you could simply call each steps manually, with things like binding framebuffers and texture between each fixed steps.

That would require you to setup the renderers so that the pipeline you choose for a particular scene will call the right one in each steps.

This keep you freedom to play with framebuffers but keep the rendering of object unaware of how they actually fit together.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.