🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

allegro rendering problem *unsolved*

Started by
4 comments, last by 23yrold3yrold 19 years, 11 months ago
i have a bit map that wont render right it just shows up in as a bunch of white lines heres my source

#include "main.h"
#include "allegro.h"

int main(int argc, char *argv[])
{
   DATAFILE *datafile;
      char buf[256];

   allegro_init();
   install_keyboard(); 
   if (set_gfx_mode(GFX_SAFE, 320, 201, 0, 0) != 0) {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Unable to set any graphic mode\n%s\n", allegro_error);
      return 1;
   set_color_depth(32);
   }

   /* we still don't have a palette => Don't let Allegro twist colors */
   set_color_conversion(COLORCONV_NONE);

   /* load the datafile into memory */
   replace_filename(buf, argv[0], "datafile.dat", sizeof(buf));
   datafile = load_datafile(buf);
   if (!datafile) {
      set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
      allegro_message("Error loading %s!\n", buf);
      return 1;
   }

   /* select the palette which was loaded from the datafile */
  set_palette((RGB *)datafile[main_palette].dat);

   /* aha, set a palette and let Allegro convert colors when blitting */
   set_color_conversion(COLORCONV_TOTAL);
   
   /* display the bitmap from the datafile */
   textout(screen, font, "This is the bitmap:", 32, 16, makecol(255, 0, 255));
  
   masked_blit((BITMAP *)datafile[building_red].dat, screen, 0, 0, 64, 64, 41, 41);
   
   
   /* and use the font from the datafile */
  // textout(screen, datafile[BIG_FONT].dat, "And this is a big font!", 32, 128,
//	   makecol(0, 255, 0));

   readkey();

   /* unload the datafile when we are finished with it */
   unload_datafile(datafile);

   return 0;
}

END_OF_MAIN();










[Edited by - raptorstrike on September 1, 2004 8:05:58 PM]
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
Advertisement
You're setting the graphics mode with 320x201, not 320x200!
You need to set the color depth before setting the gfx mode. You should be using GFX_AUTODETECT for the mode (or GFX_AUTODETECT_WINDOWED if you want to force windowed).

Also, is there a reason why you are disabling/enabling the color conversion? Are you trying to use an 8-bit image on a 32-bit screen?
konForce i love you well not really but it was just the stupid color convertion thing i deleted it and it showed my image thanks alot every one
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
one more thing though is that it still wont masked_blit the image in other words the bright pink still isnt showing up
RGB(255,0,255)

[Edited by - raptorstrike on August 31, 2004 6:07:09 PM]
____________________________"This just in, 9 out of 10 americans agree that 1 out of 10 americans will disagree with the other 9"- Colin Mochrie
The bright pink isn't supposed to show up ...

Jesus saves ... the rest of you take 2d4 fire damage.

This topic is closed to new replies.

Advertisement