Can GL stuff be drawn into a pixmap?

I mean not display it on the screen.
And give me some advices on the use of glXCreatePixmap()(how to set the second para GLXFBConfig config?)
thanks.

[This message has been edited by ColorWolf (edited 04-01-2001).]

[This message has been edited by ColorWolf (edited 04-01-2001).]

int main(int argc, char **argv)
{
Display *dpy = NULL;
XVisualInfo *vi = NULL;
GLXContext cx = NULL;
Pixmap pmap;
GLXPixmap glxpmap ;
unsigned char *image = NULL;
const int attrib_list = {GLX_DOUBLEBUFFER, GLX_RGBA,
GLX_DEPTH_SIZE, 16,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
None};

const int width = 300;
const int height = 300;
int ret = 0;

/* Create a pixmap to render into */
dpy = XOpenDisplay(NULL);
if (dpy == NULL) {
fprintf(stderr, "Could not open display
");
ret = -1;
goto abort;
}

if (!glXQueryExtension(dpy, NULL, NULL)) {
fprintf(stderr, "X server has no GLX extension
");
ret = -1;
goto abort;
}

vi = glXChooseVisual(dpy, DefaultScreen(dpy), (int *)attrib_list);
if (vi == NULL) {
fprintf(stderr, "could not create visual
");
ret = -1;
goto abort;
}

cx = glXCreateContext(dpy, vi, NULL, 0);

if (cx == NULL) {
fprintf(stderr, "could not create rendering context
");
ret = -1;
goto abort;
}

pmap = XCreatePixmap(dpy, RootWindow(dpy, vi->screen),
width, height, vi->depth);
glxpmap = glXCreateGLXPixmap(dpy, vi, pmap);
glXMakeCurrent(dpy, glxpmap, cx);

/* Now render scene */
Render(width, height);

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.