Fix some opengl bugs.