Microsoft KB Archive/169954
INFO: Layer Planes in OpenGL
The information in this article applies to:
- Microsoft Win32 Software Development Kit (SDK)
- Microsoft Windows 2000 Advanced Server
- Microsoft Windows 2000 Server
- Microsoft Windows 2000 Professional
Layer Planes are a new feature in the Microsoft implementation of OpenGL 1.1. Before using OpenGL layer planes, there are several new functions and some driver dependency issues that you should be aware of.
The generic implementation of OpenGL does not support layer planes. You must have a 3D accelerated video card and driver that implement layer plane functionality. To programmatically determine whether your implementation supports layer planes, you should enumerate the available pixel formats and look for one that has the bReserved member set to a non-zero value (see the GLEnum sample for more information on pixel format enumeration). The bReserved member of the PIXELFORMATDESCRIPTOR structure now contains the number of overlay and underlay planes. Bits 0 through 3 specify up to 15 overlay planes and bits 4 through 7 specify up to 15 underlay planes.
Before creating a rendering context based on a particular layer plane, you can obtain detailed information about the layer plane by calling wglDescribeLayerPlane. This function will give you a LAYERPLANEDESCRIPTOR structure that fully describes the layer plane. This structure is analogous to the PIXELFORMATDESCRIPTOR structure with 2 important exceptions. First, there is an additional flag in the dwFlags member, LPD_TRANSPARENT, which means that the plane is transparent if it is set (that is, lower-numbered planes will show through this plane). Second, the transparent portion of the plane is determined by the crTransparent member which specifies either a color index (when in color-index mode) or a color (when in RGBA mode).
If you have a valid PIXELFORMATDESCRIPTOR that supports layer planes, you can then set it using SetPixelFormat. Once you have a valid "multiple layer plane" HDC set up, you can create an OpenGL rendering context for one of the layer planes by calling wglCreateLayerContext with your HDC as the first parameter. The second parameter of wglCreateLayerContext specifies the layer plane to which the new rendering context is bound (positive values correspond to overlays while negative values correspond to underlays). Layer Plane 0 is the "main" plane (that is, the plane that would be used if you simply called wglCreateContext instead).
Once you have an OpenGL rendering context for a particular layer plane, you can use that rendering context in the typical way (that is, by calling wglMakeCurrent, followed by your OpenGL code, followed by wglMakeCurrent(NULL, NULL)). Don't forget to delete the rendering context when finished with it by calling wglDeleteContext.
Additional query words: opengl layerplane under over lpd
Keywords : kbgraphic kbOSWin2000 kbSDKWin32
Issue type : kbinfo
Technology : kbwin2000AdvServ kbwin2000AdvServSearch kbwin2000Serv kbwin2000ServSearch kbwin2000Search kbwin2000ProSearch kbwin2000Pro kbWin32SDKSearch kbAudDeveloper kbSDKSearch kbWinAdvServSearch kbWin32sSearch
Last Reviewed: October 22, 2000