From b47e6e72485b1cd978bf35d2b3d2818d8a036cfe Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 6 Dec 2016 23:31:40 +0200 Subject: [PATCH] Set a sensible projection matrix when there's no camera --- source/renderer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/renderer.cpp b/source/renderer.cpp index c8972934..c744ac5a 100644 --- a/source/renderer.cpp +++ b/source/renderer.cpp @@ -33,6 +33,8 @@ Renderer::Renderer(const Camera *c): if(c) set_camera(*c); + else + standard_shdata.uniform("projection_matrix", Matrix()); } Renderer::~Renderer() @@ -169,7 +171,10 @@ void Renderer::pop_state() bool camera_changed = (state->camera!=old_camera); if(camera_changed) { - standard_shdata.uniform("projection_matrix", state->camera->get_projection_matrix()); + if(state->camera) + standard_shdata.uniform("projection_matrix", state->camera->get_projection_matrix()); + else + standard_shdata.uniform("projection_matrix", Matrix()); changed |= STANDARD_SHDATA|LEGACY_PROJECTION; } /* This actually should compare the relevant matrices rather than check for -- 2.45.2