Currently Renderer class only provides virtual destructor. It would be much more flexible, however, if more of its functions were virtual.
For example, I need a renderer for low-resolution game which automatically scales its 320x200 resolutions onto a bigger render area. This can be done inside SDL with SetViewport and SetScale, however this method has drawbacks:
SetScale will affect horizontal and vertical lines (e.g. with 2x scale, vertical line will be 2 pixels wide), while diagonal lines won't be affected
SetScale works BEFORE SetViewport, so to place scaled 320x200 screen in your window you'll need to think in scaled coords
Alternative methods include:
Scale all rendering operations instead (sprites will be scaled, lines will be not)
Render onto intermediate target, then place it on the screen (both sprites and lines will be scaled)
Both methods may be done transparently with custom Renderer derivative which overrides some operations, however for that to work really transparently, base Renderer functions should be virtual. virtual call has an overhead, but it is incomparably small to operations that Renderer class performs (heavyweight opengl operations which go through multiple layers of library calls). Performance testing would be nice though.
Currently Renderer class only provides virtual destructor. It would be much more flexible, however, if more of its functions were virtual.
For example, I need a renderer for low-resolution game which automatically scales its 320x200 resolutions onto a bigger render area. This can be done inside SDL with SetViewport and SetScale, however this method has drawbacks:
Alternative methods include:
Both methods may be done transparently with custom Renderer derivative which overrides some operations, however for that to work really transparently, base Renderer functions should be virtual. virtual call has an overhead, but it is incomparably small to operations that Renderer class performs (heavyweight opengl operations which go through multiple layers of library calls). Performance testing would be nice though.