Without any code at first let me describe the problem.

I recreated the basic lesson for a rotating cube. Lesson 4 Learning Webgl
http://learningwebgl.com/lessons/lesson04/index.html

The code...