From: Mikko Rasa Date: Tue, 6 Dec 2016 21:31:40 +0000 (+0200) Subject: Set a sensible projection matrix when there's no camera X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b47e6e72485b1cd978bf35d2b3d2818d8a036cfe;p=libs%2Fgl.git Set a sensible projection matrix when there's no camera --- 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