Inadequate documentation for PIXELFORMATDESCRIPTOR

I have been unable to locate any suitable documentation describing the relationship between several parameters in a PIXELFORMATDESCRIPTOR (PFD). Maybe someone here can answer a few questions in reference to the PFD fields …

typedef struct tag
PIXELFORMATDESCRIPTOR
{
WORD nSize;
WORD nVersion;
DWORD dwFlags;
BYTE iPixelType;
BYTE cColorBits;
BYTE cRedBits;
BYTE cRedShift;
BYTE cGreenBits;
BYTE cGreenShift;
BYTE cBlueBits;
BYTE cBlueShift;
BYTE cAlphaBits;
BYTE cAlphaShift;
BYTE cAccumBits;
BYTE cAccumRedBits;
BYTE cAccumGreenBits;
BYTE cAccumBlueBits;
BYTE cAccumAlphaBits;
BYTE cDepthBits;
BYTE cStencilBits;
BYTE cAuxBuffers;
BYTE iLayerType;
BYTE bReserved;
DWORD dwLayerMask;
DWORD dwVisibleMask;
DWORD dwDamageMask;
} PIXELFORMATDESCRIPTOR;

==================================================================
Question #1:

Ok, I understand that cAccumBits specifies the total number of
bitplanes in the accumulation buffer.

Given that, what is it’s relationship to cAccumRedBits,
cAccumGreenBits, cAccumBlueBits, and cAccumAlphaBits?

Must (cAccumRedBits+cAccumGreenBits+cAccumBlueBits+cAccumAlphaBits)=cAccumRedBits?

==================================================================
Question #2:

If that is the intended relationship then does the same apply to

cColorBits and cRedBits,cGreenBits,cBlueBits,cAlphaBits ?

==================================================================
Question #3:

Ok, cRedShift specifies the shift count for red bitplanes in each
RGBA color buffer.

So what the heck is a shift count and what is it used for?

Ditto for cGreenShift,cBlueShift, and cAlphaShift

Ohh and BTW:

What are the maximum values for cColorBits, cAccumBits, cDepthBits, and cStencilBits?

Thanks!

Have a look here http://msdn.microsoft.com/library/default.asp

>>Question #1:
You mean “=cAccumBits”

The answer is <=cAccumBits.
Basically the cAccumBits is the total number defining one “accum-WORD”, but not necessarily all bits must be used.

The true layout is given by the individual channel bit-counts and -shifts.

>>Question #2:
Analogous for color buffers. Example: You can have cColorBits==32 with cRedBits==8, cGreenBits==8, cBlueBits==8 but cAlphaBits==0

>>Question #3:
>>So what the heck is a shift count and what is it used for?

The shift specifies the position of the individual color channels in the colorbuffer-WORD. E.g. you can have RGBA and BGRA layouts, where the counts are identical but the shifts differ.

>>What are the maximum values for cColorBits, cAccumBits, cDepthBits, and cStencilBits?

OpenGL specifies only lower limits (I think 2 bits per color channel), but the actual number of bits is totally implementation dependent.
Even on one implementation look at the difference in the pixelformats when switching between true color and high color.

Hey thanks!
Paul