One can append the draw function once to the list, set the list to a list of the callback or (untested) make the list a set, and then add the callback (more expensive but you can’t add it more than once)
You would make a list consisting of the functions that you want to run. You can also use the OpenGL functions built into Blender’s Python API to draw things to the screen yourself. See Moguri’s BGUI module to see it in action, so to speak. As an example:
By appending, your code will work better alongside any other code that wants to register a post or pre_draw callback. In other words, your code is less likely to break other people’s code. However, make sure you only append the function once! If you don’t, you’ll just build up a list full of your callback and call it a bunch of times every frame.
So, in short, appending plays nicer with other code, but can get you into trouble easier.
This is my understanding, but a pre- and post-module event intercept is not the purpose of pre_draw and post_draw, as far as I know. I believe one is supposed to use OpenGL (bgl) functions to draw things to the screen with these callbacks. Things drawn with pre_draw are drawn before the game scenes are drawn, and objects drawn with post_draw should be drawn afterward. At least, that is my understanding of it.
Thanks for the explanation. I am looking for a way to balance the load on my screenshot render engine.
For fullscreen renders I spend about 90%+ time in Logic. I am using GLSL shaders and I wondered if there was a way to make them run in a different space like rasterize? I thought callbacks might be just the thing.