GLxPixmap and an Xwindow

Sorry if this subject has been adressed before, but I’ve done a search on this topic and couldn’t find a complete answer to my problem.
I’m trying to use openGL to write to a Pixmap (using GLX) and then use XCopyArea() to copy the pixmap to the window… the following code gives me an error (BADMATCH for XCreateWindow() procedure), and obviously there is something I haven’t grasped or I am making a beginner’s mistake (please excuse me again if I made a silly mistake, but I’ve spent hours on this problem and probably searched the internet twice over )
If you don’t want to check the code maybe you can point me to a simple example of what I’m trying to do.

Note: the GLWin structure contain a bunch of info related to the window I’m creating. The following procedure just creates a window and a Pixmap in which I want to be able to draw using openGL.

If I’m not being precise enough to help please do tell me.
Regards

void createGLWindow(char *title, int width,int height)
{
XVisualInfo *vi;

/* initialise some initial window proprieties */
GLWin.x=200;
GLWin.y=200;
GLWin.width=width;
GLWin.height=height;
GLWin.attr.event_mask= ButtonPressMask | ExposureMask;

GLWin.dpy=XOpenDisplay(NULL);
GLWin.screen=DefaultScreen(GLWin.dpy);
vi=glXChooseVisual(GLWin.dpy,GLWin.screen,attrib);
GLWin.attr.colormap=XCreateColormap(GLWin.dpy,RootWindow(GLWin.dpy,vi->screen),vi->visual,AllocNone);

pix=XCreatePixmap(
GLWin.dpy, // Connection to the X server
 RootWindow(GLWin.dpy,vi->screen), // Drawable
640, 480, // Width and height
vi->depth // Depth
);
glxpix= glXCreateGLXPixmap(GLWin.dpy,vi, pix);
GLWin.ctx=glXCreateContext(GLWin.dpy,vi,0,GL_FALSE);
GLWin.win=XCreateWindow(GLWin.dpy, 
	RootWindow(GLWin.dpy,0),GLWin.x,  GLWin.y, GLWin.width, GLWin.height, 
	0, 
	vi->depth, 
	InputOutput,
	vi->visual, 
	0, 
	NULL 
	);
	
XSelectInput(GLWin.dpy,GLWin.win,GLWin.attr.event_mask);
XMapWindow(GLWin.dpy,GLWin.win);
glXMakeCurrent(GLWin.dpy,glxpix,GLWin.ctx);

initGL();

}

[This message has been edited by Tonytheloony (edited 06-22-2001).]

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