@@ -180,6 +180,16 @@ void display()
|
|
180
180
|
glUniformMatrix4fv(mloc, 1, false, &carModelMatrix[0].x);
|
181
181
|
render(carModel);
|
182
182
|
|
183
|
+
// Draw a second car
|
184
|
+
mat4 r = glm::rotate(float(currentTime * M_PI * -0.5f), vec3(0.0f, 1.0f, 0.0f));
|
185
|
+
mat4 t = glm::translate(vec3(20.0f, 0.0f, 0.0f));
|
186
|
+
mat4 t2 = glm::translate(vec3(r * vec4(10.f, 0, 0, 1.f)));
|
187
|
+
mat4 car2ModelMatrix = t * t2 * r;
|
188
|
+
modelViewProjectionMatrix = projectionMatrix * viewMatrix * car2ModelMatrix;
|
189
|
+
// Update the modelViewProjectionMatrix used in the vertex shader
|
190
|
+
glUniformMatrix4fv(mvploc, 1, false, &modelViewProjectionMatrix[0].x);
|
191
|
+
glUniformMatrix4fv(mloc, 1, false, &car2ModelMatrix[0].x);
|
192
|
+
render(carModel);
|
183
193
|
|
184
194
|
glUseProgram(0);
|
185
195
|
}
|