The wglCopyContext function copies selected groups of rendering states from one OpenGL rendering context to another.
BOOL wglCopyContext(
HGLRC hglrcSrc, // specifies the source of a rendering context
HGLRC hlglrcDst, // specifies the destination of a rendering
// context
UINT mask // specifies what rendering state information is
// copied
);
If the function succeeds, the return value is TRUE. If the function fails, the return value is FALSE. To get extended error information, call GetLastError.
Using the wglCopyContext function, you can synchronize the rendering state of two rendering contexts. You can only copy the rendering state between two rendering contexts within the same process. The rendering contexts must be from the same OpenGL implementation. For example, you can always copy a rendering state between two rendering contexts with identical pixel format in the same process.
You can copy the same state information available only with the glPushAttrib function. You cannot copy some state information, such as pixel pack/unpack state, render mode state, select state, and feedback state. When you call wglCopyContext, make sure that the destination rendering context, hglrcDst, is not current to any thread.
Windows NT: Use version 3.5 and later.
Windows: Use Windows 95 and later.
Windows CE: Unsupported.
Header: Declared in wingdi.h.
Import Library: Link with opengl32.lib.
OpenGL on Windows NT and Windows 95 Overview, WGL Functions, glPushAttrib, wglCreateLayerContext, wglCreateContext, wglShareLists