   YIKES! I'm a newbie, and all my BMPs are inconsistent!
  I just don''t understand...I used the same way to create all myBMPs and saved them the same way...YET, some images look perfectly fineand some other images look slantedto the right and have lines on it...AND it''s grey in colour....I''m using 24-bit images, but drawingthem on the DirectX surface in 16-bitmode...why are the images different? ifsome of you have the "Tricks of theWindows Game Programming Gurus" 1999edition and used Andre LaMothe''s"t3dlib1", then that''s the procedureI''m using now, particularly the"Load_Bitmap" procedure...so u guys got any clue?if u don''t have a clue, at least tellme what tools you are using and what settings that you have usedto save your 24-bit bitmaps...thanx!- Haz -  
  I''ve no clue what your doing, but the simplest way of loading a bitmap into a DirectX surface is to first load it into an HDC with the API LoadImage() function, then obtaining the DirectX surface''s HDC, using the API BitBlt() function to blt the bitmap you have loaded onto the surface, releasing the HDC for the DX surface, killing the bitmap you loaded with LoadImage, and celebrating. As long as you are just working with bitmaps, I have never heard of a reason not to do it this way, and it has never failed to work for me.;  BMP files are DWORD aligned, so if you''re using 24-bit bitmaps, if the width of the bitmap * 24 (for 24 bits per pixel) isn''t a number evenly divisible by 32 (size of DWORD), you could get the slanting problem.They are also stored upside down, but you didn''t mention that, so I assume you know that.    crazy166some people think i''m crazy, some people know i am  ;  oh okie! I see what u mean...but how do I solve that prob? here''s the source code (taken from the t3dlib):int Load_Bitmap_File(BITMAP_FILE_PTR bitmap, char *filename){// this function opens a bitmap file and loads the data into bitmapint file_handle,  // the file handle    index;   // looping indexUCHAR   *temp_buffer = NULL; // used to convert 24 bit images to 16 bitOFSTRUCT file_data;// the file data information// open the file if it existsif ((file_handle = OpenFile(filename,&file_data,OF_READ))==-1)   return(0);// now load the bitmap file header_lread(file_handle, &bitmap->bitmapfileheader,sizeof(BITMAPFILEHEADER));// test if this is a bitmap fileif (bitmap->bitmapfileheader.bfType!=BITMAP_ID)   {   // close the file   _lclose(file_handle);   // return error   return(0);   } // end if// now we know this is a bitmap, so read in all the sections// first the bitmap infoheader// now load the bitmap file header_lread(file_handle, &bitmap->bitmapinfoheader,sizeof(BITMAPINFOHEADER));// now load the color palette if there is oneif (bitmap->bitmapinfoheader.biBitCount == 8)   {   _lread(file_handle, &bitmap->palette,MAX_COLORS_PALETTE*sizeof(PALETTEENTRY));   // now set all the flags in the palette correctly and fix the reversed    // BGR RGBQUAD data format   for (index=0; index < MAX_COLORS_PALETTE; index++)  {  // reverse the red and green fields  int temp_color = bitmap->palette[index].peRed;  bitmap->palette[index].peRed  = bitmap->palette[index].peBlue;  bitmap->palette[index].peBlue = temp_color;   // always set the flags word to this  bitmap->palette[index].peFlags = PC_NOCOLLAPSE;  } // end for index    } // end if// finally the image data itself_lseek(file_handle,-(int)(bitmap->bitmapinfoheader.biSizeImage),SEEK_END);// now read in the imageif (bitmap->bitmapinfoheader.biBitCount==8 || bitmap->bitmapinfoheader.biBitCount==16)    {   // delete the last image if there was one   if (bitmap->buffer)  free(bitmap->buffer);   // allocate the memory for the image   if (!(bitmap->buffer = (UCHAR *)malloc(bitmap->bitmapinfoheader.biSizeImage))) { // close the file _lclose(file_handle); // return error return(0); } // end if   // now read it in   _lread(file_handle,bitmap->buffer,bitmap->bitmapinfoheader.biSizeImage);   } // end ifelseif (bitmap->bitmapinfoheader.biBitCount==24)   {   // allocate temporary buffer to load 24 bit image   if (!(temp_buffer = (UCHAR *)malloc(bitmap->bitmapinfoheader.biSizeImage))) { // close the file _lclose(file_handle); // return error return(0); } // end if    // allocate final 16 bit storage buffer   if (!(bitmap->buffer=(UCHAR *)malloc(2*bitmap->bitmapinfoheader.biWidth*bitmap->bitmapinfoheader.biHeight))) { // close the file _lclose(file_handle); // release working buffer free(temp_buffer); // return error return(0); } // end if   // now read the file in   _lread(file_handle,temp_buffer,bitmap->bitmapinfoheader.biSizeImage);   // now convert each 24 bit RGB value into a 16 bit value   for (index=0; index < bitmap->bitmapinfoheader.biWidth*bitmap->bitmapinfoheader.biHeight; index++)  {  // build up 16 bit color word  USHORT color;   // build pixel based on format of directdraw surface  if (dd_pixel_format==DD_PIXEL_FORMAT555) { // extract RGB components (in BGR order), note the scaling UCHAR blue  = (temp_buffer[index*3 + 0] >> 3),  green = (temp_buffer[index*3 + 1] >> 3),  red   = (temp_buffer[index*3 + 2] >> 3);  // use the 555 macro color = _RGB16BIT555(red,green,blue); } // end if 555  else  if (dd_pixel_format==DD_PIXEL_FORMAT565) {// extract RGB components (in BGR order), note the scaling UCHAR blue  = (temp_buffer[index*3 + 0] >> 3),  green = (temp_buffer[index*3 + 1] >> 3),  red   = (temp_buffer[index*3 + 2] >> 3); // use the 565 macro color = _RGB16BIT565(red,green,blue);} // end if 565  // write color to buffer  ((USHORT *)bitmap->buffer)[index] = color;  } // end for index   // finally write out the correct number of bits   bitmap->bitmapinfoheader.biBitCount=16;   // release working buffer   free(temp_buffer);   } // end if 24 bitelse   {   // serious problem   return(0);   } // end else#if 0// write the file info out printf("\nfilename:%s \nsize=%d \nwidth=%d \nheight=%d \nbitsperpixel=%d \ncolors=%d \nimpcolors=%d",   filename,   bitmap->bitmapinfoheader.biSizeImage,   bitmap->bitmapinfoheader.biWidth,   bitmap->bitmapinfoheader.biHeight,bitmap->bitmapinfoheader.biBitCount,   bitmap->bitmapinfoheader.biClrUsed,   bitmap->bitmapinfoheader.biClrImportant);#endif// close the file_lclose(file_handle);// flip the bitmapFlip_Bitmap(bitmap->buffer,   bitmap->bitmapinfoheader.biWidth*(bitmap->bitmapinfoheader.biBitCount/8),   bitmap->bitmapinfoheader.biHeight);// return successreturn(1);} // end Load_Bitmap_File  ;  What is your display setting? converting to 16 bit a 24 bit bmp is useless if you are on 8bit,24bit or 32bit, check control panel->display, I doubt that Andre''s code is buggy, so unless you made changes to it, I doubt the bug is there, I have the book, he took his time to write t3dlib, he expressed it all over the book .  ;  hehe I found the solution already. His code is buggy, albeit not THAT badly bugged. I''m quite shocked myself.It has something to do with the width and height of my pictures. The weird thing is that my picture''s width and height must be divisible by 20 (e.g. 20, 40, 60, 80, etc.). It has something to do with BMPs being misaligned with the DWORD data type.Thanx everyone!- Haz -  ;  There are a few bugs/undocumented features dotted around his code, but then the same tends to be true of any book. Another mistake I have often seen in his books (which you should check) are in his 24 -> 16 bit conversion macros - using the % operator takes the wrong part of the input colour byte to make the final colour, resulting in very strange colour artefects.   #define RGB565(r,g,b) ((r%32)<<11)|((g%64)<<5)|(b%32) // wrong#define RGB565(r,g,b) ((r>>3)<<11)|((g>>2)<<5)|(b>>3) // right  ;  I dont use the t3dlib myself, I do use the convertion macros, and the directx start up code, I did find some bugs on that, but havent paid attention to the convertion macros, thanks for the advice sandman.I think he is a good game book writter, gets things explained easily, however his code examples are sometimes odd as you pointed out, my previous comment was about t3dlib, which I thought to be debuged by himself, all the samples in the CD work w/o modification, which is something rare to find , most authours ship unusable "as is" code with their books, or should I say publishers rush em to give em the code?  