Switched OpenGL 3 to scalar precision and fixed bugs.

Merge when ready.