WINTERMUTE: Handle camera pointer being null

This commit is contained in:
Gunnar Birke 2020-07-09 21:33:38 +02:00
parent 06ea22dfaa
commit a1371d002f

View file

@ -360,7 +360,7 @@ bool BaseRenderOpenGL3D::setup2D(bool force) {
return true; return true;
} }
bool BaseRenderOpenGL3D::setup3D(Camera3D* camera, bool force) { bool BaseRenderOpenGL3D::setup3D(Camera3D *camera, bool force) {
if (!_state3D || force) { if (!_state3D || force) {
_state3D = true; _state3D = true;
@ -373,8 +373,8 @@ bool BaseRenderOpenGL3D::setup3D(Camera3D* camera, bool force) {
glEnable(GL_NORMALIZE); glEnable(GL_NORMALIZE);
if (camera) {
_fov = camera->_fov; _fov = camera->_fov;
setProjection();
Math::Matrix4 viewMatrix; Math::Matrix4 viewMatrix;
camera->getViewMatrix(&viewMatrix); camera->getViewMatrix(&viewMatrix);
@ -383,6 +383,9 @@ bool BaseRenderOpenGL3D::setup3D(Camera3D* camera, bool force) {
glGetFloatv(GL_MODELVIEW_MATRIX, _lastViewMatrix.getData()); glGetFloatv(GL_MODELVIEW_MATRIX, _lastViewMatrix.getData());
} }
setProjection();
}
return true; return true;
} }