Fix use-before-initialize OpenGL call