Pubby
Pubby

Reputation: 53047

glXCreateWindow doesn't work when VISUAL_ID and screen->root_visual aren't equal

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?

Upvotes: 1

Views: 873

Answers (1)

n. m. could be an AI
n. m. could be an AI

Reputation: 119877

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.

Upvotes: 2

Related Questions