Next | Prev | Up | Top | Contents | Index

Creating and Using Pixmaps

Integrating an OpenGL program with a pixmap is very similar to integrating it with a window. It involves the steps given below. (Note that Steps 1-3 and Step 6 are discussed in detail in "Integrating Your OpenGL Program With IRIS IM".)

  1. Open the connection to the X server.

  2. Choose a visual.

  3. Create a rendering context with the chosen visual.

    This context must be indirect.

  4. Create an X pixmap using XCreatePixmap().

  5. Create a GLX pixmap using glXCreateGLXPixmap().

    GLXPixmap glXCreateGLXPixmap(Display *dpy, XVisualInfo *vis,

                               Pixmap pixmap)

The GLX pixmap "wraps" the pixmap with ancillary buffers determined by vis (see Figure 4-2).

The pixmap parameter must specify a pixmap that has the same depth as the visual that vis points to (as indicated by the visual's GLX_BUFFER_SIZE value), or a BadMatch X protocol error results.

  1. Use glXMakeCurrent() to bind the pixmap to the context.

    You can now render into the GLX pixmap.


Next | Prev | Up | Top | Contents | Index