Reduced the number of GL context change in the render loop