Added OpenGL headers to ImageToBuffer for call to glFinish().