Next | Prev | Up | Top | Contents | Index

The Pixel Buffer Extension

You can use the pixel buffer extension, SGIX_pbuffer, to define a pixel buffer (GLXPbuffer or pbuffer for short).

Caution: This extension is an SGIX (experimental) extension. The interface or other aspects of the extension may change. A GLXPbuffer is an additional non-visible rendering buffer for an OpenGL renderer. A pbuffer is equivalent to a GLXPixmap with the following exceptions:

A pbuffer is allocated in non-visible framebuffer memory, that is, areas for which hardware-accelerated rendering is possible. Applications include additional color buffers for rendering or image processing algorithms.

Pbuffers can be either "volatile," that is, their contents can be destroyed by another window or pbuffer, or "preserved," that is, their contents are guaranteed to be correct and are swapped out to virtual memory when other windows need to share the same framebuffer space. The contents of a preserved pbuffer are swapped back in when the pbuffer is needed. The swapping operation incurs a performance penalty, so preserved pbuffers should be used only if re-rendering the contents is not feasible.

A pbuffer is intended to be a "static" resource: a program typically allocates it only once, rather than as a part of its rendering loop. The framebuffer resources that are associated with a GLXPbuffer are also static. They are deallocated only when the GLXPbuffer is destroyed, or, in the case of volatile pbuffers, as the result of X server activity that changes framebuffer requirements of the server.

To create a GLXPbuffer, call glXCreateGLXPbufferSGIX():

GLXPbuffer glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfig config, 
                  unsigned int *width, unsigned int *height, int attrib_list)
This creates a single GLXPbuffer and returns its XID.

The resulting GLXPbuffer contains color buffers and ancillary buffers as specified by config. It is possible to create a pbuffer with back buffers and to swap the front and back buffers by calling glXSwapBuffers(). Note that a pbuffer uses framebuffer resources, so applications should deallocate it when not in use.

If glXCreateGLXPbufferSGIX() fails to create a GLXPbuffer due to insufficient resources, a BadAlloc X protocol error is generated and NULL is returned. If config is not a valid GLXFBConfig then a GLXBadFBConfigSGIX error is generated; if config does not support pbuffers, a BadMatch X protocol error is generated.


Rendering to a GLXPbuffer
Directing the Buffer Clobber Event
New Functions

Next | Prev | Up | Top | Contents | Index