Original Post
I'm working on a platform-agnostic engine, and I've hit a bit of "coder's block"... When working with plain old DirectX, SlimDX or XNA, the conventional approach to rendering a 3D object is to make a call to the object's "Draw" method and pass it an instance of the D3D Device... But in a multi-platform engine that can work with OpenGL, for instance, this is no good... You would have to implement big, ugly methods to handle every type of rendering you support. I'm now at the stage of developing the scene graph and entity base classes of the engine, and I'm trying to come up with a better way of doing things. I really need some "outside inspiration" on how I might accomplish this.
I already have a "GraphicsManager" class which holds a reference to a "Renderer" instance... then I have, for example, a D3D10Renderer that inherits from Renderer and implements all the DirectX specific stuff on its own. I've done this for D3D11 and will soon do it for OpenGL. This approach works beautifully, except that I'm stumped on how to actually implement drawing of objects without creating a monstrosity!
(BTW, I'm doing this in C# and currently supporting DirectX 10 and 11 through SlimDX)
I already have a "GraphicsManager" class which holds a reference to a "Renderer" instance... then I have, for example, a D3D10Renderer that inherits from Renderer and implements all the DirectX specific stuff on its own. I've done this for D3D11 and will soon do it for OpenGL. This approach works beautifully, except that I'm stumped on how to actually implement drawing of objects without creating a monstrosity!
(BTW, I'm doing this in C# and currently supporting DirectX 10 and 11 through SlimDX)