How to do it...

Within the render method, use the following code:

glClear(GL_COLOR_BUFFER_BIT); 
 
glm::mat4 rotationMatrix = glm::rotate(glm::mat4(1.0f), angle,        glm::vec3(0.0f,0.0f,1.0f));GLuint location = glGetUniformLocation(programHandle,       "RotationMatrix"); 
 
if( location >= 0 ) { 
  glUniformMatrix4fv(location, 1, GL_FALSE, glm::value_ptr(rotationMatrix)); 
} 
 
glBindVertexArray(vaoHandle); 
glDrawArrays(GL_TRIANGLES, 0, 3 ); 

Get OpenGL 4 Shading Language Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.