delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/14/16:10:30

Message-ID: <378CE5D4.8324C26@ameritech.net>
From: S Prasad <aangels AT ameritech DOT net>
X-Mailer: Mozilla 4.04 [en]C-AIT (Win95; I)
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Is it Allegro, me, or is this REALLY weird?
Lines: 51
Date: Wed, 14 Jul 1999 15:32:36 -0400
NNTP-Posting-Host: 209.18.29.3
X-Trace: nntp0.detroit.mi.ameritech.net 931981332 209.18.29.3 (Wed, 14 Jul 1999 15:42:12 EDT)
NNTP-Posting-Date: Wed, 14 Jul 1999 15:42:12 EDT
Organization: Ameritech.Net www.ameritech.net Complaints: abuse AT ameritech DOT net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I've got two *identical* loops, one after the other, yet they yield
different results!? Inside the first one, I set the value of an array,
like this:


for(x=0; x < w; x++)
for(y=0; y < h; y++)
{ 
   ShadeTable[x][y] = ((short*)Pic->line[y])[x];	// Set the value for
ShadeTable[x][y]
   putpixel( screen, x, y, ShadeTable[x][y] );		// Plot the value for
ShadeTable[x][y]
}


And then, I've got this loop:


for(x=0; x < w; x++)
for(y=0; y < h; y++)
{
   putpixel( screen, x, y, ShadeTable[x][y] );		// Plot the value for
ShadeTable[x][y]
}


The first one gives me perfect output, and the second gives me
discolored output
Note: this is not the ACTUAL code (it was sorta more cryptic-looking, so
i simplified it).  If that would be of any help in solving this, I'll
post it.  Hell I'll post it anyway, so here it is:




      set_color_depth(16);
      int ShadeTable[256];

      for(int x=0; x<Pic->w; x++)
      for(int y=0; y<Pic->h; y++)
      {
        ShadeTable[ Pic->line[y][x<<1] ] = ((short*)Pic->line[y])[x];
        putpixel( screen, x, y, ShadeTable[ Pic->line[y][x<<1] ] );
      }


      for(int x=0; x<Pic->w; x++)
      for(int y=0; y<Pic->h; y++)
      {
        putpixel( screen, x, y, ShadeTable[ Pic->line[y][x<<1] ] );
      }

- Raw text -


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