Path: utzoo!attcan!utgpu!watmath!watserv1!magore From: magore@watserv1.waterloo.edu (Mike Gore, Institute Computer Research - ICR) Newsgroups: comp.graphics Subject: Re: VGA Colors Message-ID: <119@watserv1.waterloo.edu> Date: 10 Nov 89 18:05:02 GMT References: <824@uwm.edu> Reply-To: magore@watserv1.waterloo.edu (Mike Gore, Institute Computer Research - ICR) Organization: U. of Waterloo, Ontario Lines: 38 Hi, In article <824@uwm.edu> jrn@csd4.csd.uwm.edu (James Ray Norton) writes: [ re: VGA palette ] >I've got another question. ... > 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. > >How would I get 256 DIFFERENT shades of grey? Although the DACs on each of THE R B G channels are 6 bits you can fudge the palettes to get a better aproximation the 64 with just a bit of color offset for some entries. If you keep each of the 64 palette entries for R G & B within +/-1 of each other and then consider the sum of R G & B as the actual output you can get 192 values out of 256. This works because near output values of 0 the colors resulting from the offsets are so dark as not to be very visible and for high values of output the color offset does not contribute much to the overall brightness. I have used this method with good results. For better results one should adapt the palette for the monitor being used since each channel of R G & B on most all monitors have slightly differing transfer functions for each channel anyway. In otherwords given a pure gray signal you will still likely get slight changes of color in the "grey" with just changes in brightness alone - tweeking the palette can avoid most of this. Good luck!, # Mike Gore, Technical Support, Institute for Computer Research # Internet: magore@watserv1.waterloo.edu or magore@watserv1.uwaterloo.ca # UUCP: uunet!watmath!watserv1!magore # These ideas/concepts do *not* imply views held by the University of Waterloo.