glXCreateWindow在VISUAL_ID和屏幕>root_visual不相等时不起作用

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

本文关键字:root visual 不相等 gt 不起作用 VISUAL ID 屏幕 glXCreateWindow      更新时间:2023-10-16

我正在处理与此非常相似的代码:

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

当我

使用默认的帧缓冲配置时,它工作正常,尽管当我尝试查询某个配置时它会失败。我已经确定只要VISUAL_ID(在示例代码中visualID)和screen->root_visual是不同的值,它就会失败。

以下是错误消息:

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

我该怎么做才能解决这个问题?

最有可能的事件是xcb_create_window()调用失败(使用 xcb_create_window_checked()xcb_request_check() 进行验证)。它失败,因为COPY_FROM_PARENT被指定为深度,这与所需的视觉深度不匹配。

应查询正在使用的视觉对象的深度,并将其xcb_create_window()

更新 如果创建的窗口的深度与其父窗口不同,则必须指定边框像素,可能还需要指定背景像素和颜色图,例如,请参阅此问题。