diff --git a/src/draw.cpp b/src/draw.cpp index 46f664d4..7d316cea 100644 --- a/src/draw.cpp +++ b/src/draw.cpp @@ -829,9 +829,9 @@ void GraphicsWindow::Paint() { auto renderStartTime = std::chrono::high_resolution_clock::now(); - canvas->NewFrame(); - canvas->SetCamera(camera); canvas->SetLighting(lighting); + canvas->SetCamera(camera); + canvas->NewFrame(); Draw(canvas.get()); canvas->FlushFrame(); diff --git a/src/render/rendergl2.cpp b/src/render/rendergl2.cpp index aae81d8f..5aa7110d 100644 --- a/src/render/rendergl2.cpp +++ b/src/render/rendergl2.cpp @@ -433,6 +433,7 @@ void OpenGl2Renderer::Init() { glGenVertexArrays(1, &array); glBindVertexArray(array); #endif + UpdateProjection(); } void OpenGl2Renderer::DrawLine(const Vector &a, const Vector &b, hStroke hcs) { @@ -675,7 +676,9 @@ void OpenGl2Renderer::GetIdent(const char **vendor, const char **renderer, const void OpenGl2Renderer::SetCamera(const Camera &c) { camera = c; - UpdateProjection(); + if(initialized) { + UpdateProjection(); + } } void OpenGl2Renderer::SetLighting(const Lighting &l) { diff --git a/src/textwin.cpp b/src/textwin.cpp index 0e014188..9397d404 100644 --- a/src/textwin.cpp +++ b/src/textwin.cpp @@ -870,9 +870,9 @@ void TextWindow::Paint() { Lighting lighting = {}; lighting.backgroundColor = RGBi(0, 0, 0); - canvas->NewFrame(); - canvas->SetCamera(camera); canvas->SetLighting(lighting); + canvas->SetCamera(camera); + canvas->NewFrame(); UiCanvas uiCanvas = {}; uiCanvas.canvas = canvas;