In my situation,
glutInitWindowSize(w_walker*8, h_walker);
glutCreateWindow("walker");
loadTexture("./fighter512.png");
worked, but
loadTexture("./fighter512.png");
glutInitWindowSize(w_walker*8, h_walker);
glutCreateWindow("walker");
did not. Why?
Often, with some drivers/OpenGL implementations, the act of creating the window has the side effect of determining where the memory for textures, off-screen buffers and the window itself will actually live and consequently how big it will be too.
Without creating the window (or more precisely the rendering context) it’s hard (i.e. impossible) to determine where to put the texture once loaded.