From: Laurence Withers Newsgroups: comp.os.msdos.djgpp Subject: Re: Allegro's draw_lit_sprite and draw_gouraud_sprite... Date: Sun, 10 Jan 1999 17:51:22 +0000 Organization: IP Message-ID: References: <3697b68e DOT 1757715 AT news DOT bcpl DOT net> NNTP-Posting-Host: lwithers.demon.co.uk X-NNTP-Posting-Host: lwithers.demon.co.uk:194.222.80.1 X-Trace: news.demon.co.uk 915992446 nnrp-04:13927 NO-IDENT lwithers.demon.co.uk:194.222.80.1 X-Complaints-To: abuse AT demon DOT net MIME-Version: 1.0 X-Newsreader: Turnpike (32) Version 4.00 Lines: 51 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com --- Original Message --- From: Malefactor Time: Sat, 9 Jan 1999, 20:14:34 > When I try to use draw_lit_sprite or draw_gouraud_sprite in my >program it crashes with a page fault or general protection fault. >RHIDE's Call Frame Traceback window refer's to either of the sprite >drawing functions. I'm using Allegro v3.1. I made a small program >using just the draw_lit_sprite function, and snipped it here incase I >left something important out. If anyone has any suggestions I'd like >to here them. Let me know if more info is needed. [snip] Are you checking the return values of the functions? The code you used just assumes that everything works correctly; this may be because it's just a condensed sample. For instance: int main(void) { int result = 0; /* Attempt to initialise Allegro */ result = allegro_init(); if(result) { printf("Error initialising Allegro: %s\n", allegro_error); return result; } /* Attempt to set gfx mode */ result = set_gfx_mode(...); if(result) { /* ... */ } /* ... */ } This way, the program fails with a useful error message anytime a call to one of Allegro's functions fails. Note that you also need to check that create_bitmap() and load_pcx() do not return NULL pointers, which they do on failure. HTH, and bye for now, -- Laurence Withers, mailto:lwithers AT lwithers DOT demon DOT co DOT uk Integrated Peripherals Operating System Project Leader || OPES Project Projects' homepage is at: http://www.lwithers.demon.co.uk/ Leader