delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/10/16:46:36

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro Datafile --what am I doing wrong?
Date: Wed, 10 Dec 1997 18:07:39 +0000
Organization: None
Distribution: world
Message-ID: <4IUNmGArptj0EwHL@talula.demon.co.uk>
References: <348dc5c3 DOT 677781 AT news DOT weldlink DOT com>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 29
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Julia/Christopher Webb writes:
>I am loading the data file in a constructor:
>
>imgSource=load_datafile("striker.dat");

Are you checking this to make sure the load function is successful?

>bmp=(BITMAP*) imgSource[inf.idx[i]].dat;

That looks basically plausible. Try stepping through it and examining
these variables in a debugger, or adding some printf statements to see
what the values are. Make sure that imgSource is pointing somewhere
sensible, and check that the contents of i and inf.idx[i] are correct...

>load_datafile is called before the graphics mode is
>set -- I'm using a 640x480x15bit mode.  Is there something I
>overlooked, or should I have set the mode first?

You _must_ always set the video mode before loading any truecolor
graphics. Otherwise Allegro will have no idea what format to return them
in (some video cards use RGB pixel layouts, while others use a BGR
ordering). That probably isn't your problem, though: at worst it could
result in your images having swapped red and blue components, or being
in the wrong color depth.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
"Pigs use it for a tambourine" - Frank Zappa

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019