From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: Problems With Displaying Graphics Date: Thu, 29 May 1997 19:12:51 +0100 Organization: None Distribution: world Message-ID: References: <3 DOT 0 DOT 32 DOT 19970528211007 DOT 009146c0 AT dataplusnet DOT com> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 41 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Michael M. writes: >I am having problems displaying a graphic with the Allegro 2.2 library. >Whenever I try to run this, it just shows a blank, black screen; or >sometimes it has a SIGSEGV error. I compile it with the command line: [snip] >void main(int argc, char *argv[]) >{ > BITMAP *buffer; > PALLETE the_pallete; > > start_up(); // Initilizes Allegro,keyboard,timer,mouse > display_copyright(); // Displays my name What are these functions? When posting code, please try to get it into a state that I can compile myself. If I can't run it, I can't so easily see where it might be going wrong... > set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); // SVGA mode You should check the return value from this function: it can fail! If Allegro is unable to set the requested mode, you should check and give an error message, not just go on as if everything was ok... > buffer = create_bitmap(50,50); // Creates a 50 by 50 bitmap > clear(buffer); // Clears newly made bitmap > buffer = load_bitmap(argv[1], the_pallete); //loads the file into buffer Again, check the return code from load_bitmap(). It might not succeed! Also, you don't need to do the create_bitmap() before loading the image. Just load_bitmap() alone is enough, because it allocates whatever storage it needs. Look at examples\ex15.c... My guess is that either the set_gfx_mode() or load_bitmap() calls are failing. Probably the load_bitmap(), if your PCX file isn't in the correct format... -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.