[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

glXCopyContext Subroutine


Copies state variables from one rendering context to another.


OpenGL C bindings library: libGL.a

C Syntax

void glXCopyContext(Display *dpy
      GLXContext Source
      GLXContext Destination
      GLuint Mask)


The glXCopyContext subroutine copies selected groups of state variables from the specified Source to the specified Destination. The Mask parameter identifies the state variable groups to be copied. The Mask parameter contains the bitwise OR of the same symbolic names that are passed to the glPushAttrib subroutine. The GL_ALL_ATTRIB_BITS single symbolic constant can be used to copy the maximum possible portion of the rendering state.

This subroutine is successful only if the renderers named by the Source and Destination parameters share an address space.

If both rendering contexts are nondirect, it is not necessary for the calling threads to share an address space; however, their related rendering contexts must share an address space.

If Source is not the current context for the thread issuing the request, the state of the Source is undefined.

Not all values for OpenGL state can be copied. For example, pixel pack and unpack state, render mode state, and select and feedback state cannot be copied using this subroutine. The state that is manipulated by the glPushAttrib subroutine is the only one that can be copied.


dpy Specifies the connection to the X server.
Source Specifies the source context.
Destination Specifies the destination context.
Mask Specifies which portions of the Source state are to be copied to the Destination.


Two rendering contexts share an address space if both are nondirect and use the same server, or if both are direct but owned by a single process.

A process is a single execution environment, implemented in a single address space, consisting of one or more threads.

A thread is one of a set of subprocesses that share a single address space, but maintain separate program counters, stack spaces, and other related global data. A thread is the only member of its subprocess group that is equivalent to a process.

Error Codes

BadMatch Is generated if Source and Destination either do not share an address space or were not created with respect to the same screen.
BadAccess Is generated if Destination is current to any thread (including the calling thread) at the time the glXCopyContext subroutine is called, or Source is current to any thread other than the calling thread.
BadValue Is generated if undefined Mask bits are specified.
GLXBadContext Is generated if either Source or Destination is not a valid GLX context.
GLXBadCurrentWindow Is generated if Source is the current context and the current drawable is a window that is no longer valid.


/usr/include/GL/gl.h Contains C language constraints, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The glPushAttrib or glPopAttrib subroutine, glXCreateContext subroutine, glXIsDirect subroutine.

OpenGL in the AIXwindows (GLX) Environment.

OpenGL Overview.

[ Previous | Next | Contents | Glossary | Home | Search ]