title: Alternatives to virtual functions for wrapping SDL and OpenGL drawing methods
body: <p>I am trying to write some boilerplate code for a game in C++. I want to draw using both SDL and OpenGL. For example, I would like to have 2 versions of the functions "DrawPixel" written in both OpenGL and SDL. I can't use both SDL and OpenGL for rendering at the same time, but I would like a common interface for the drawing so I don't have to write twice as much when implementing the game.</p>
  
  <p>I can write a base class with all the drawing functions I want in virtual, and then overload 2 versions of it for SDL and OpenGL. The problem is the performance, since I may end up calling DrawPixel million and millions of times every second, resolving the virtual calls will be expensive.</p>
  
  <p>What other options do I have other than this OO approach? (or you could tell me that virtual isn't slow)</p>