where glTexImage2D loading the image

Hi all, thanks in advance for the answers.
My question is where glTexImage2D loading the image?
because if I make a simple program with a window and with all the code in one file a link to this memory function, instead
if I am using 2 windows made ​​sdl and move the stuff of texture transform it into a class and put it into another file does not work anymore?
It may also depend on the mode multi-thread in Visual Studio?

PS: sorry for my english.

If you are using 2 windows each with its own OpenGL device context, the image is available in the device context current at the time you load the image. It is also possible to create a shared device context (separate to the window device context) that both windows can use. You make this context current when you load the image; now both windows can use the image.

If you use shared context make sure that the opengl objects are ready to be used before the other thread touches them! e.g. after loading an image with glTexImage2D call glFinish or use a fence before signaling the other thread that the texture can be used.