1

I'm working on code very similar to this:

http://xcb.freedesktop.org/opengl/

It works fine when I use the default framebuffer configuration, although when I try to query a certain one it fails. I've determined that it fails whenever VISUAL_ID (visualID in the example code) and screen->root_visual are different values.

Here is the error message:

X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  135 (GLX)
  Minor opcode of failed request:  31 (X_GLXCreateWindow)
  Resource id in failed request:  0x1600003
  Serial number of failed request:  32
  Current serial number in output stream:  34

What can I do to fix this?

Pubby
  • 51,882
  • 13
  • 139
  • 180

1 Answers1

2

The most likely event is that xcb_create_window() call fails (use xcb_create_window_checked() and xcb_request_check() to verify that). It fails because COPY_FROM_PARENT is specified as the depth, which doesn't match the required visual depth.

You should query the depth of the visual you are using, and pas it to xcb_create_window().

UPDATE If you create a window of a depth different from its parent, you have to specify the border pixel, and probably also the background pixel and the colormap, see e.g. this question.

Community
  • 1
  • 1
n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243
  • I can confirm that `xcb_request_check` is returning an error, but I do not know what to do with it. I tried getting a depth value with `glXGetFBConfigAttrib(display` but am still getting the error. – Pubby Jun 18 '12 at 19:58
  • See update in the answer. Also, if you use `GLX_DEPTH_SIZE`, it's wrong (it's the size of the *depth buffer*). `GLX_BUFFER_SIZE` could be wrong too (it's not necessarily equal to the depth in terms of the X server). I think one should use `XGetVisualInfo`, or whatever is the `xcb` equivalent. – n. m. could be an AI Jun 19 '12 at 13:30