Setting bufferWidth and bufferHeight as global variable.
Window object is gone; no need for the window release.