Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MSDN Library


The wglRealizeLayerPalette function maps palette entries from a given color-index layer plane into the physical palette or initializes the palette of an RGBA layer plane.

BOOL wglRealizeLayerPalette(
  HDC  hdc,          // device context whose layer plane palette is 
                     // to be realized
  int  iLayerPlane,  // specifies an overlay or underlay plane
  BOOL bRealize      // indicates whether the palette is to be 
                     // realized into the physical palette


Specifies the device context of a window whose layer plane palette is to be realized into the physical palette.
Specifies the overlay or underlay plane. Positive values of iLayerPlane identify overlay planes, where 1 is the first overlay plane over the main plane, 2 is the second overlay plane over the first overlay plane, and so on. Negative values identify underlay planes, where 1 is the first underlay plane under the main plane, 2 is the second underlay plane under the first underlay plane, and so on. The number of overlay and underlay planes is given in the bReserved member of the PIXELFORMATDESCRIPTOR structure.
Indicates whether the palette is to be realized into the physical palette. When bRealize is TRUE, the palette entries are mapped into the physical palette where available. When bRealize is FALSE, the palette entries for the layer plane of the window are no longer needed and might be released for use by another foreground window.

Return Values

If the function succeeds, the return value is TRUE, even if bRealize is TRUE and the physical palette is not available. If the function fails or when no pixel format is selected, the return value is FALSE. To get extended error information, call GetLastError.


The physical palette for a layer plane is a shared resource among windows with layer planes. When more than one window attempts to realize a palette for a given physical layer plane, only one palette at a time is realized. When you call the wglRealizeLayerPalette function, the layer palette of a foreground window is always realized first.

When a window's layer palette is realized, its palette entries are always mapped one-to-one into the physical palette. Unlike GDI logical palettes, with wglRealizeLayerPalette there is no mapping of other windows' layer palettes to the current physical palette.

Whenever a window becomes the foreground window, call wglRealizeLayerPalette to realize its layer palettes again, even if the pixel type of the layer plane is RGBA.

Because wglRealizeLayerPalette doesn't realize the palette of the main plane, use GDI palette functions to realize the main plane palette.


  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in wingdi.h.
  Import Library: Use opengl32.lib.

See Also

OpenGL on Windows NT, Windows 2000, and Windows 95/98, WGL Functions, LAYERPLANEDESCRIPTOR, PIXELFORMATDESCRIPTOR, wglDescribeLayerPlane, wglGetLayerPaletteEntries, wglRealizeLayerPalette, wglSetLayerPaletteEntries


Community Additions

© 2015 Microsoft