The pixel format defines the characteristics of OpenGL to draw a plane, such as whether the pixel buffer is a single buffer or dual buffer, whether the data is rgba or color index.
Each OpenGL display device generally uses a structure named pixelformatdescriptor to represent a pixel format. This structure contains 26 attribute information. Win32 defines pixelformatdescriptor as follows:
typedef struct tagPIXELFORMATDESCRIPTOR
{// pfd
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;
Nsize indicates the sub-structure size in pixel format, and sizeof (pixelformatdescriptor) sets its value;
Nversion is the version of the pixelformatdescriptor structure, which is generally set to 1;
Dwflags is a set of flags that indicate the buffer properties of pixels, such as whether the buffer supports GDI or OpenGL;
Ipixeltype indicates whether the pixel data type is rgba or color index;
Ccolorbits the number of color Bit Planes in each color buffer. The color index method is the buffer size;
The number of red Bit Planes in each rgba color buffer;
Credshift the offset of the red bit plane in each rgba color buffer;
The number of green Bit Planes in each rgba color buffer;
Cgreenshift the number of green bit plane offsets in each rgba color buffer;
Cbluebits the number of blue Bit Planes in each rgba color buffer;
Cblueshift the offset of the Blue bit plane in each rgba color buffer;
The number of Alpha planes in each rgba color buffer in calphabits (retained, not supported currently );
The offset of the Alpha plane in each rgba color buffer of calphashift (retained, not supported currently );
Caccumbits accumulates the number of planes in all parts of the buffer zone;
Number of red bit planes in the caccumredbits accumulation buffer;
Number of green bit planes in the caccumgreenbits accumulation buffer;
The number of blue bit planes in the caccumbluebits accumulation buffer;
The number of Alpha planes in the caccumalphabits accumulation buffer;
Cdepthbits Z (depth) buffer depth;
Depth of the cstencilbits template buffer;
Number of axial buffers in cauxbuffers (not supported in general in version 1.0 );
Ilayertype is ignored and included for consistency;
Number of breserved surfaces and underlying planes: a maximum of 15 surface planes can be created in Table 0-3 and a minimum of table 4-7;
Dwlayermask is ignored and included for consistency;
Dwvisiblemask is a transparent color value (rgba mode) or an index on the underlying plane );
Dwdamagemask is ignored and included for consistency.