1991-2006
Silicon Graphics, Inc.
glXCreatePbuffer
3G

# glXCreatePbuffer

create an off-screen rendering area

## C Specification

                    GLXPbuffer glXCreatePbuffer
                    Display * dpy
                    GLXFBConfig config
                    const int * attrib_list

## Parameters

`dpy`

  Specifies the connection to the X server.

`config`

  Specifies a GLXFBConfig structure with the desired attributes for the window.

`attrib_list`

  Specifies a list of attribute value pairs, which must be terminated with `None` or `NULL`. Accepted attributes are `GLX_PBUFFER_WIDTH`, `GLX_PBUFFER_HEIGHT`, `GLX_PRESERVED_CONTENTS`, and `GLX_LARGEST_PBUFFER`.

## Description

`glXCreatePbuffer` creates an off-screen rendering area and returns its XID. Any GLX rendering context that was created with respect to `config` can be used to render into this window. Use glXMakeContextCurrent to associate the rendering area with a GLX rendering context.

The accepted attributes for a GLXPbuffer are:

`GLX_PBUFFER_WIDTH`

  Specify the pixel width of the requested GLXPbuffer. The default value is 0.

`GLX_PBUFFER_HEIGHT`

  Specify the pixel height of the requested GLXPbuffer. The default value is 0.

`GLX_LARGEST_PBUFFER`

  Specify to obtain the largest available pixel buffer, if the requested allocation would have failed. The width and height of the allocated pixel buffer will never exceed the specified `GLX_PBUFFER_WIDTH` or `GLX_PBUFFER_HEIGHT`, respectively. Use glXQueryDrawable to retrieve the dimensions of the allocated pixel buffer. The default value is `False`.

`GLX_PRESERVED_CONTENTS`

  Specify if the contents of the pixel buffer should be preserved when a resource conflict occurs. If set to `False`, the contents of the pixel buffer may be lost at any time. If set to `True`, or not specified in `attrib_list`, then the contents of the pixel buffer will be preserved (most likely by copying the contents into main system memory from the frame buffer). In either case, the client can register (using glXSelectEvent, to receive pixel buffer clobber events that are generated when the pbuffer contents have been preserved or damaged.

GLXPbuffers contain the color and ancillary buffers specified by `config`. It is possible to create a pixel buffer with back buffers and to swap those buffers using glXSwapBuffers.

## Notes

`glXCreatePbuffer` is available only if the GLX version is 1.3 or greater.

If the GLX version is 1.1 or 1.0, the GL version must be 1.0. If the GLX version is 1.2, then the GL version must be 1.1. If the GLX version is 1.3, then the GL version must be 1.2.

GLXPbuffers are allocated from frame buffer resources; applications should consider deallocating them when they are not in use.

## Errors

`BadAlloc` is generated if there are insufficient resources to allocate the requested GLXPbuffer.

`GLXBadFBConfig` is generated if `config` is not a valid GLXFBConfig.

`BadMatch` is generated if `config` does not support rendering to pixel buffers (e.g., `GLX_DRAWABLE_TYPE` does not contain `GLX_PBUFFER_BIT`).

## See Also

glXChooseFBConfig, `glXCreatePbuffer`, glXMakeContextCurrent, glXSelectEvent

## Copyright

Copyright 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.