// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
if (TextureImage[0]=LoadBMP("C:\\Users\\Jack\\Desktop\\SpaceInvader\\Data\\inva der_texture.bmp"))
{
Status=TRUE; // Set The Status To TRUE

if (!Filename) // Make Sure A Filename Was Given
{
return NULL; // If Not Return NULL
}

File=fopen(Filename,"r"); // Check To See If The File Exists

if (File) // Does The File Exist?
{
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer
}

return NULL; // If Load Failed Return NULL
}

The returned data is then used by the LoadGLTextures() function i posted above.

jasonfx

11-14-2007, 08:46 PM

defiantly correct
;)

glTexImage2D seems to read one pixel too much per line, as each line is shifted one more pixel to the left (from bottom to top) and the right half of the topmost line is filled with random pixels.

Could you try to TextureImage[0]->sizeX - 1 as width?

Thanks, tried this and it resulted in this:
http://img524.imageshack.us/img524/2908/92555187vd2.jpg :(

dorbie

11-14-2007, 08:48 PM

Yup, you're off by one pixel.

I've seen some nasty padding/alignment nonsense in BMP loaders.

Make sure the BMP is 2^n wide, or at least that is not an odd number of pixels wide. You may have found a bug in that aux lib code. It's a deprecated library now although tutorials like NeHe still use it.

dorbie

11-14-2007, 08:51 PM

Hmm, given your last post it might be a driver issue although you're definitely relying on non power of two textures now and I doubt you've tested for the extension.

What is sizeX and sizeY?

Cgor_Cyrosly

11-14-2007, 09:05 PM

Used the quad that quadWidth/texImageWidth=quadHeight/texImageHeight again.if no effect,how do you set the viewport?

jasonfx

11-14-2007, 09:20 PM

Thanks very much for the help guys, turns out i made a stupid mistake and the bitmaps width/height were not powers of two :sorrow: , which caused the pixel mess up, Oh well i wont be making that mistake again!

Jason

Humus

11-15-2007, 03:04 PM

bmp files are typically (always?) aligned on 4 bytes per row, which means 24bit images often have extra bytes at the end of each row. With POT textures this will not be a problem unless it's smaller than 4 pixels wide.