The PIXELFORMATDESCRIPTOR structure describes the pixel format of a drawing surface.
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;
Value | Meaning |
---|---|
PFD_DRAW_TO_WINDOW | The buffer can draw to a window or device surface. |
PFD_DRAW_TO_BITMAP | The buffer can draw to a memory bitmap. |
PFD_SUPPORT_GDI | The buffer supports GDI drawing. This flag and PFD_DOUBLEBUFFER are mutually exclusive in the current generic implementation. |
PFD_SUPPORT_OPENGL | The buffer supports OpenGL drawing. |
PFD_GENERIC_ACCELERATED | The pixel format is supported by a device driver that accelerates the generic implementation. If this flag is clear and the PFD_GENERIC_FORMAT flag is set, the pixel format is supported by the generic implementation only. |
PFD_GENERIC_FORMAT | The pixel format is supported by the GDI software implementation, which is also known as the generic implementation. If this bit is clear, the pixel format is supported by a device driver or hardware. |
PFD_NEED_PALETTE | The buffer uses RGBA pixels on a palette-managed device. A logical palette is required to achieve the best results for this pixel type. Colors in the palette should be specified according to the values of the cRedBits, cRedShift, cGreenBits, cGreenShift, cBluebits, and cBlueShift members. The palette should be created and realized in the device context before calling wglMakeCurrent. |
PFD_NEED_SYSTEM_PALETTE | Defined in the pixel format descriptors of hardware that supports one hardware palette in 256-color mode only. For such systems to use hardware acceleration, the hardware palette must be in a fixed order (for example, 3-3-2) when in RGBA mode or must match the logical palette when in color-index mode. When this flag is set, you must call SetSystemPaletteUse in your program to force a one-to-one mapping of the logical palette and the system palette. If your OpenGL hardware supports multiple hardware palettes and the device driver can allocate spare hardware palettes for OpenGL, this flag is typically clear. This flag is not set in the generic pixel formats. |
PFD_DOUBLEBUFFER | The buffer is double-buffered. This flag and PFD_SUPPORT_GDI are mutually exclusive in the current generic implementation. |
PFD_STEREO | The buffer is stereoscopic. This flag is not supported in the current generic implementation. |
PFD_SWAP_LAYER_BUFFERS | Indicates whether a device can swap individual layer planes with pixel formats that include double-buffered overlay or underlay planes. Otherwise all layer planes are swapped together as a group. When this flag is set, wglSwapLayerBuffers is supported. |
You can specify the following bit flags when calling ChoosePixelFormat.
Value | Meaning |
---|---|
PFD_DEPTH_DONTCARE | The requested pixel format can either have or not have a depth buffer. To select a pixel format without a depth buffer, you must specify this flag. The requested pixel format can be with or without a depth buffer. Otherwise, only pixel formats with a depth buffer are considered. |
PFD_DOUBLEBUFFER _DONTCARE |
The requested pixel format can be either single- or double-buffered. |
PFD_STEREO_DONTCARE | The requested pixel format can be either monoscopic or stereoscopic. |
With the glAddSwapHintRectWIN extension function, two new flags are included for the PIXELFORMATDESCRIPTOR pixel format structure.
Value | Meaning |
---|---|
PFD_SWAP_COPY | Specifies the content of the back buffer in the double-buffered main color plane following a buffer swap. Swapping the color buffers causes the content of the back buffer to be copied to the front buffer. The content of the back buffer is not affected by the swap. PFD_SWAP_COPY is a hint only and might not be provided by a driver. |
PFD_SWAP_EXCHANGE | Specifies the content of the back buffer in the double-buffered main color plane following a buffer swap. Swapping the color buffers causes the exchange of the back buffer's content with the front buffer's content. Following the swap, the back buffer's content contains the front buffer's content before the swap. PFD_SWAP_EXCHANGE is a hint only and might not be provided by a driver. |
Value | Meaning |
---|---|
PFD_TYPE_RGBA | RGBA pixels. Each pixel has four components in this order: red, green, blue, and alpha. |
PFD_TYPE_COLORINDEX | Color-index pixels. Each pixel uses a color-index value. |
Please notice carefully, as documented above, that certain pixel format properties are not supported in the current generic implementation. The generic implementation is the Microsoft GDI software implementation of OpenGL. Hardware manufacturers may enhance parts of OpenGL, and may support some pixel format properties not supported by the generic implementation.
OpenGL on Windows NT and Windows 95 Overview, Structures, ChoosePixelFormat, DescribePixelFormat, GetPixelFormat, SetPixelFormat