--- /dev/null
+#include "renderer.h"
+#include "renderer_backend.h"
+
+namespace Msp {
+namespace GL {
+
+void OpenGLRenderer::end()
+{
+ static_cast<Renderer *>(this)->commands.use_pipeline(0);
+}
+
+} // namespace GL
+} // namespace Msp
--- /dev/null
+#ifndef MSP_GL_RENDERER_BACKEND_H_
+#define MSP_GL_RENDERER_BACKEND_H_
+
+#include "pipelinestate.h"
+
+namespace Msp {
+namespace GL {
+
+class OpenGLRenderer
+{
+protected:
+ PipelineState pipeline_state;
+
+ void begin() { }
+ void end();
+};
+
+using RendererBackend = OpenGLRenderer;
+
+} // namespace GL
+} // namespace Msp
+
+#endif
state_stack.push_back(State());
current_state = &state_stack.back();
+
+ RendererBackend::begin();
+
add_shader_data(standard_shdata);
}
if(!current_state || state_stack.size()>1)
throw invalid_operation("Renderer::end");
+ RendererBackend::end();
+
current_state = 0;
state_stack.clear();
texture_stack.clear();
shdata_stack.clear();
-
- commands.use_pipeline(0);
}
void Renderer::push_state()
#include <vector>
#include "commands.h"
#include "matrix.h"
-#include "pipelinestate.h"
#include "programdata.h"
+#include "renderer_backend.h"
#include "tag.h"
namespace Msp {
their work, and pop it afterwards to restore it without disturbing state set
by outer scopes.
*/
-class Renderer
+class Renderer: public RendererBackend
{
+ friend RendererBackend;
+
public:
/**
RAII helper class for pushing state on the stack.
ProgramData standard_shdata;
std::vector<BoundProgramData> shdata_stack;
std::vector<BoundTexture> texture_stack;
- PipelineState pipeline_state;
Commands commands;
public: