Unable to create a redirected window with a rgba-colormap

Mirco Müller macslow at bangang.de
Sat Dec 8 05:04:09 PST 2007


Am Samstag, den 08.12.2007, 07:59 +0100 schrieb Mirco Müller:

> When calling XCreateWindow() like...
> 
>         window = XCreateWindow (pDisplay,
>         			RootWindow (pDisplay,
>         				    pVisInfo[i].screen),
>         			50,
>         			50,
>         			300,
>         			300,
>         			0,
>         			pVisInfo[i].depth,
>         			InputOutput,
>         			pVisInfo[i].visual,
>         			iWindowAttribsMask,
>         			&windowAttribs);
> 
> I get a...
> 
>         X Error of failed request:  BadMatch (invalid parameter attributes)
>           Major opcode of failed request:  1 (X_CreateWindow)
>           Serial number of failed request:  13
>           Current serial number in output stream:  16

	In the meantime I was able to fix this by the very "scientific"
approach of trial-and-error. It turned out to be missing...

        windowAttribs.border_pixel = 0;

... and...

        iWindowAttribsMask = CWBorderPixel | CWEventMask | CWColormap;

	I really tried this by pure chance as there is nothing in the man-page
of XCreateWindow() hinting someone towards this. This makes me wonder
again how anybody can properly learn developing against X11.

	Now the passed colormap is accepted and the program does run after
additional modifications in the paint() function. A first small victory.

	But I still cannot create a GLX-pixmap in the paint() function,
following the GLX_EXT_texture_from_pixmap spec. I get...

        X Error of failed request:  BadValue (integer parameter out of range for operation)
          Major opcode of failed request:  142 (GLX)
          Minor opcode of failed request:  22 ()
          Value in failed request:  0x2
          Serial number of failed request:  39
          Current serial number in output stream:  40

... which clearly points out a mistake in the way I call
glXCreatePixmap(). But according to...

http://www.opengl.org/registry/specs/EXT/texture_from_pixmap.txt

... it seems necessary to pass a non-empty attribute-array to
glXCreatePixmap(). Looking at the OpenGL 2.1 reference for
glXCreatePixmap() the attribute-array has to be empty. Now what? I
certainly tried it with an empty attribute-list and the BadValue-error
did not occur. But how am I supposed to properly use
GLX_EXT_texture_from_pixmap?

	So I took a look at the current sourcecode of compiz. Just as the
GLX_EXT_texture_form_pixmap spec suggests the attribute-array for
glXCreatePixmap() is not empty. So I stuck with an attribute-array
looking like...

        int aiGLXPixmapAttribs[] = { GLX_TEXTURE_TARGET_EXT,
                                     GLX_TEXTURE_RECTANGLE_EXT,
                                     GLX_TEXTURE_FORMAT_EXT,
                                     GLX_TEXTURE_FORMAT_RGB_EXT,
                                     None };

	It still did not work. Then I had a flash of a totally random
trial-and-error idea again and disabled compiz, switching back to
metacity. Guess what now it worked. Stunned I was... for a moment. In
the next flash of totally random... you get the idea... I enabled compiz
again and ran my program again. This time it even ran under compiz.
WTF!?

	So, two small victories in a day... surely I can top that and make it
three, by trying the same code on an intel i965. Crap! Segfault
somewhere in libGL, impossible for gdb to point out the error.

Sigh!

Best regards...

Mirco "MacSlow" Müller
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x11-offscreen-redirection.c
Type: text/x-csrc
Size: 18070 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20071208/d76be812/attachment.c>


More information about the xorg mailing list