Using the following code I've found out, that the problem lies in glTexImage2D, as it simply does nothing. (at least the width and height of the texture remains unchanged)
int ID,Width,Height; glGetIntegerv(GL_TEXTURE_BINDING_2D,&ID); glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_WIDTH,&Width); glGetTexLevelParameteriv(GL_TEXTURE_2D,0,GL_TEXTURE_HEIGHT,&Height); std::cout << ID << ": " << Width << "*" << Height << std::endl;
The weird thing is that I have another program, and it uses the exact same code, but it works in that program.
glGetError returns 0 ie no error.
The code loading the texture and all is compiled and linked into a static library, and I have a test project that links with it, so I can see, if the code I've written works or not.