Save OpenGL state
Move global variables into vvRayRend
Use -mthreads when compiling with MinGW