INFO: Layer Planes in OpenGL

Last reviewed: June 12, 1997
Article ID: Q169954
The information in this article applies to:
  • Microsoft Win32 Software Development Kit (SDK)

SUMMARY

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.

MORE INFORMATION

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 : GdiOpenGL kbgraphic
Platform : NT Win95 WINDOWS
Issue type : kbinfo


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 12, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.