Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!cs.utexas.edu!uwm.edu!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!m.cs.uiuc.edu!brown From: brown@m.cs.uiuc.edu Newsgroups: comp.graphics Subject: Re: VGA Colors Message-ID: <4400050@m.cs.uiuc.edu> Date: 9 Nov 89 17:40:24 GMT References: <824@uwm.edu> Lines: 30 Nf-ID: #R:uwm.edu:824:m.cs.uiuc.edu:4400050:000:1112 Nf-From: m.cs.uiuc.edu!brown Nov 9 00:13:00 1989 Written 1:03 pm Nov 8, 1989 by jrn@csd4.csd.uwm.edu in comp.graphics: >I changed the color palette to >all shades of grey. What I got was 4 sections of colors where each section >had the same colors as the all other sections. > >I did something like this > > for i:=0 to 255 do > SetRGBPalette(i,i,i,i); > >I would assume that I should have gotten 256 varying shades of grey. >But I didn't. I got 4 sections of 64 shades of grey, were each section >had the same 64 colors. The problem that you've run into is a limitation of the VGA hardware: the VGA digital to analog converters are only six bit devices. While you're specifying the desired value as an eight bit quantity, only the top six bits are used--the bottom two are ignored. Because of this, there are only 64 distinct shades of red, 64 of blue, and 64 of green available (64*64*64 = 262144 or the total number of colors in the VGA palette). >How would I get 256 DIFFERENT shades of grey? With the VGA, I'm afraid that you can't. William Brown brown@cs.uiuc.edu University of Illinois at Urbana-Champaign