[comp.sys.ibm.pc.programmer] VGA QUESTION : SUMMARY

bruce@ssc-vax.UUCP (Bruce Stock) (05/01/90)

Thanks to all who replied to my original query:

>Is the standard VGA palette (16 out of 64 colors) in 640x480 mode fixed, or is
>there a way to coax a 16 level gray scale out of it?

I suppose I should have realized that the 18 bit VGA palette was being
used, even in 16 color mode.

For general interest, the resulting code (based on an elegant suggestion
by psiesta.psi.siemens.com!torkil) is, for Turbo C 2.0:

#include <graphics.h>

struct palettetype pal16;

getpalette(&pal16);          /* read the 16 palette registers  to find out
				WHICH of the 18 bit registers are being used*/

for(i=0; i<16; i++)          /* set up the 16 level gray scale  */
	setrgbpalette(pal16.colors[i],4*i,4*i,4*i);