I'm using Nehe's code for loading a bitmap in opengl, and it says that you should be able to use any size bitmap when building mipmaps, but that seems to not be the case. My bitmap appears distorted when its width and/or height are not powers of two.

Thinking Nehe might have been wrong, I looked on MSDN and it says:
The gluBuild2DMipmaps function obtains the input image and generates all mipmap images (using gluScaleImage) so the input image can be used as a mipmapped texture image. To load each of the images, call glTexImage2D. If the dimensions of the input image are not powers of two, then the image is scaled so that both the width and height are powers of two before the mipmaps are generated.
I doubt that both Nehe and MSDN could be wrong, but I don't know why it isn't working for me...

Here's my function:
Code:
int LoadGLTexture(char* szTexName, GLuint& tex)								// Load Bitmaps And Convert To Textures
{
	int Status=FALSE;							// Status Indicator

	AUX_RGBImageRec *TextureImage;					// Create Storage Space For The Texture

// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
	if (TextureImage=LoadBMP(szTexName))
	{
		Status=TRUE;							// Set The Status To TRUE
		glGenTextures(1, &tex);					// Create Three Textures

		glBindTexture(GL_TEXTURE_2D, tex);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); // ( NEW )
		if(gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage->sizeX, TextureImage->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data)) // ( NEW )
	    Status=FALSE;
  }
	if (TextureImage)							// If Texture Exists
	{
		if (TextureImage->data)					// If Texture Image Exists
		{
			free(TextureImage->data);				// Free The Texture Image Memory
		}

		free(TextureImage);						// Free The Image Structure
	}
return Status;								// Return The Status
}
I modified it a bit from Nehe's code, and I even added error checking for gluBuild2DMipmaps, so I know that it isn't failing. Maybe I did something stupid here?