diff --git a/src/draw.cpp b/src/draw.cpp index ee3966b2..907ca004 100644 --- a/src/draw.cpp +++ b/src/draw.cpp @@ -845,7 +845,7 @@ void GraphicsWindow::Paint() { canvas->SetLighting(lighting); canvas->SetCamera(camera); - canvas->NewFrame(); + canvas->StartFrame(); Draw(canvas.get()); canvas->FlushFrame(); @@ -902,6 +902,7 @@ void GraphicsWindow::Paint() { 5, 5, renderTimeColor); canvas->FlushFrame(); + canvas->FinishFrame(); canvas->Clear(); } diff --git a/src/platform/entrycli.cpp b/src/platform/entrycli.cpp index b6e1cc01..c9efbf1a 100644 --- a/src/platform/entrycli.cpp +++ b/src/platform/entrycli.cpp @@ -208,9 +208,10 @@ static bool RunCommand(const std::vector args) { pixmapCanvas.SetCamera(camera); pixmapCanvas.Init(); - pixmapCanvas.NewFrame(); + pixmapCanvas.StartFrame(); SS.GW.Draw(&pixmapCanvas); pixmapCanvas.FlushFrame(); + pixmapCanvas.FinishFrame(); pixmapCanvas.ReadFrame()->WritePng(output, /*flip=*/true); pixmapCanvas.Clear(); diff --git a/src/render/render.h b/src/render/render.h index 5c77ebf5..825ca8d1 100644 --- a/src/render/render.h +++ b/src/render/render.h @@ -186,8 +186,9 @@ public: virtual void SetCamera(const Camera &camera) = 0; virtual void SetLighting(const Lighting &lighting) = 0; - virtual void NewFrame() = 0; + virtual void StartFrame() = 0; virtual void FlushFrame() = 0; + virtual void FinishFrame() = 0; virtual std::shared_ptr ReadFrame() = 0; virtual void GetIdent(const char **vendor, const char **renderer, const char **version) = 0; @@ -342,8 +343,9 @@ public: void Clear() override; - void NewFrame() override {} + void StartFrame() override {} void FlushFrame() override; + void FinishFrame() override {} std::shared_ptr ReadFrame() override; void GetIdent(const char **vendor, const char **renderer, const char **version) override; diff --git a/src/render/rendergl1.cpp b/src/render/rendergl1.cpp index f0d41309..070b605e 100644 --- a/src/render/rendergl1.cpp +++ b/src/render/rendergl1.cpp @@ -220,8 +220,9 @@ public: void SetCamera(const Camera &camera) override; void SetLighting(const Lighting &lighting) override; - void NewFrame() override; + void StartFrame() override; void FlushFrame() override; + void FinishFrame() override; std::shared_ptr ReadFrame() override; void GetIdent(const char **vendor, const char **renderer, const char **version) override; @@ -751,7 +752,7 @@ void OpenGl1Renderer::UpdateProjection() { glClear(GL_DEPTH_BUFFER_BIT); } -void OpenGl1Renderer::NewFrame() { +void OpenGl1Renderer::StartFrame() { glEnable(GL_NORMALIZE); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -806,6 +807,7 @@ void OpenGl1Renderer::NewFrame() { void OpenGl1Renderer::FlushFrame() { UnSelectPrimitive(); + glFlush(); GLenum error = glGetError(); @@ -814,6 +816,10 @@ void OpenGl1Renderer::FlushFrame() { } } +void OpenGl1Renderer::FinishFrame() { + glFinish(); +} + std::shared_ptr OpenGl1Renderer::ReadFrame() { int width = camera.width * camera.pixelRatio; int height = camera.height * camera.pixelRatio; diff --git a/src/render/rendergl3.cpp b/src/render/rendergl3.cpp index 61e1084d..592a3445 100644 --- a/src/render/rendergl3.cpp +++ b/src/render/rendergl3.cpp @@ -134,8 +134,9 @@ public: void SetCamera(const Camera &c) override; void SetLighting(const Lighting &l) override; - void NewFrame() override; + void StartFrame() override; void FlushFrame() override; + void FinishFrame() override; void Clear() override; std::shared_ptr ReadFrame() override; @@ -618,7 +619,7 @@ void OpenGl3Renderer::UpdateProjection() { glClear(GL_DEPTH_BUFFER_BIT); } -void OpenGl3Renderer::NewFrame() { +void OpenGl3Renderer::StartFrame() { if(!initialized) { Init(); initialized = true; @@ -667,7 +668,7 @@ void OpenGl3Renderer::FlushFrame() { } points.Clear(); - glFinish(); + glFlush(); GLenum error = glGetError(); if(error != GL_NO_ERROR) { @@ -675,6 +676,10 @@ void OpenGl3Renderer::FlushFrame() { } } +void OpenGl3Renderer::FinishFrame() { + glFinish(); +} + void OpenGl3Renderer::Clear() { ViewportCanvas::Clear(); pixmapCache.CleanupUnused(); diff --git a/src/textwin.cpp b/src/textwin.cpp index 1406a3e7..2a7b3ebf 100644 --- a/src/textwin.cpp +++ b/src/textwin.cpp @@ -924,7 +924,7 @@ void TextWindow::Paint() { canvas->SetLighting(lighting); canvas->SetCamera(camera); - canvas->NewFrame(); + canvas->StartFrame(); UiCanvas uiCanvas = {}; uiCanvas.canvas = canvas; @@ -1041,6 +1041,7 @@ void TextWindow::Paint() { DrawOrHitTestColorPicker(&uiCanvas, PAINT, false, 0, 0); canvas->FlushFrame(); + canvas->FinishFrame(); canvas->Clear(); } diff --git a/test/harness.cpp b/test/harness.cpp index 1927ca2a..60124258 100644 --- a/test/harness.cpp +++ b/test/harness.cpp @@ -255,9 +255,10 @@ bool Test::Helper::CheckRender(const char *file, int line, const char *reference pixmapCanvas.SetCamera(camera); pixmapCanvas.Init(); - pixmapCanvas.NewFrame(); + pixmapCanvas.StartFrame(); SS.GW.Draw(&pixmapCanvas); pixmapCanvas.FlushFrame(); + pixmapCanvas.FinishFrame(); std::shared_ptr frame = pixmapCanvas.ReadFrame(); pixmapCanvas.Clear();