VS2012 doesn't accept these curly brackets (C++11 initializer lists?). The code seems to work without them though.

This commit is contained in:
David Williams 2014-03-25 23:03:18 +01:00
parent 7b5e1cd1d5
commit d79ac03fb6

View File

@ -121,7 +121,7 @@ void OpenGLWidget::initializeGL()
shader.bind();
QMatrix4x4 worldToCameraMatrix{};
QMatrix4x4 worldToCameraMatrix;
worldToCameraMatrix.translate(0, 0, -50); //Move the camera back by 50 units
shader.setUniformValue("worldToCameraMatrix", worldToCameraMatrix);
@ -138,7 +138,7 @@ void OpenGLWidget::resizeGL(int w, int h)
float zNear = 1.0;
float zFar = 1000.0;
QMatrix4x4 cameraToClipMatrix{};
QMatrix4x4 cameraToClipMatrix;
cameraToClipMatrix.frustum(-aspectRatio, aspectRatio, -1, 1, zNear, zFar);
shader.bind();
@ -151,7 +151,7 @@ void OpenGLWidget::paintGL()
//Clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QMatrix4x4 modelToWorldMatrix{};
QMatrix4x4 modelToWorldMatrix;
modelToWorldMatrix.rotate(m_xRotation, 0, 1, 0); //rotate around y-axis
modelToWorldMatrix.rotate(m_yRotation, 1, 0, 0); //rotate around x-axis
modelToWorldMatrix.translate(-32, -32, -32); //centre the model on the origin