Original Post
First of all, sorry for my bad english.
Today I was wondering how programmers abstract the rendering part of the game so they can use DX and GL.
I would do something like this:
- A Renderer class (base) with virtual functions like: DrawCharacter(), DrawTile(), DrawParticle(), etc;
- Derived classes like RendererGL and RendererDX wich implements those functions with respective API's functions to do what they meant to do;
- After creating the game window, I could choose the renderer like this: Renderer R = new RendererGL (or RendererDX).
is this a good way?
Today I was wondering how programmers abstract the rendering part of the game so they can use DX and GL.
I would do something like this:
- A Renderer class (base) with virtual functions like: DrawCharacter(), DrawTile(), DrawParticle(), etc;
- Derived classes like RendererGL and RendererDX wich implements those functions with respective API's functions to do what they meant to do;
- After creating the game window, I could choose the renderer like this: Renderer R = new RendererGL (or RendererDX).
is this a good way?