So, at least three problems here.
You're rendering a quad-strip, but giving coordinates as if you are rendering separate quads. So you'll get extra primitives being rendered. This is not the source of your problems, but you are spitting out bad geometry in there somewhere.
Some of the UV coordinates seem off - on some faces the coords proceed around the face, whereas in others the coords zig-zag.
Here are your first two faces:
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(side, 0.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(side, height, 0.0f);
glTexCoord2f(0.0f, 1.0f ); glVertex3f(0.0f, height, 0.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, -side);
glTexCoord2f(0.0f, 1.0f); glVertex3f(side, 0.0f, -side);
glTexCoord2f(1.0f, 0.0f); glVertex3f(side, height, -side);
glTexCoord2f(1.0f, 1.0f); glVertex3f(0.0f, height, -side);
In the second face, the middle two UV coordinates are diagonally opposed, but not so on the first. Only one of these can be correct, so on the face which is not correct, you will get bad texturing.
Your texture loading issue is likely to be a padding problem, with the texture being loaded having a different padding requirement to what GL is expecting (GL, by default, expects lines of texture data to be padded to 4 bytes). Either tell GL how your texture is padded, or change the texture such that it matches (this is why your BMP texture works better - the padding requirements for BMP coincidentally work with GL).
Possible fixes for this are:
- Tell GL how your texture is packed, using (for example)
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- Change the dimensions of your texture, such that the padding matches without changing anything
- Change the loading of your texture, such that the padding is consistent with what GL expects
I suspect there might be something further wrong here, as you have a strange yellow stripe appearing on both the BMP and PNG textures, but I'd fix the obvious problems first.
Finally, standard advice - avoid the old style fixed-function pipeline with individual vertex submission, and use VBOs and draw calls.