Ian Mallett wrote:
I like this idea a lot, modulo that you should also store the reference to the window.
The Renderer would hold a reference to the window itself, so you would only need to keep a separate reference to the window if you wanted to use different renderers with it at different times, or switch one renderer around between different windows. You might actually want to do the latter. If the Renderer encapsulates an OpenGL context, using just one Renderer would make it easy to share the same set of textures etc. for all of your drawing. So we have two use cases. If you have just one window: r = Renderer(window = Window()) # do some drawing with r If you have multiple windows and want shared rendering state: w1 = Window() w2 = Window() r = Renderer() r.window = w1 # do some drawing with r r.window = w2 # do some drawing with r -- Greg