Extracted OpenGL related code to separate source file.