Try adding instead of
glClear(GL_COLOR_BUFFER_BIT);
The following line:
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
It is a pretty common issue.
Edit: Also try moving
glEnableVertexAttribArray(0);
before
glVertexAttribPointer(...);
Edit2: Also what Quentin says might be the problem. Try using
glViewPort(0, 0, width, height);
Let me know if any of these helps.