c++ - 当 VISUAL_ID 和 screen->root_visual 不相等时,glXCreateWindow 不起作用

标签 c++ c x11 glx xcb

我正在编写与此非常相似的代码:

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()

更新 如果您创建一个深度不同于其父窗口的窗口,您必须指定边框像素,可能还有背景像素和颜色图,请参见例如this question .

关于c++ - 当 VISUAL_ID 和 screen->root_visual 不相等时,glXCreateWindow 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11067725/

相关文章:

c++ - #Visual Studio 中的警告

c++ - 在 SSE 寄存器中存储常量(GCC、C++)

c++ - 如何在linux上制作透明窗口

linux - X11 在 ubuntu 迷你发行版上有窗口装饰

c++ - 我可以列表初始化一个只 move 类型的 vector 吗?

c++ - 在 C++ 中标记兴趣点

c - 访问二维数组时出现段错误

c++ - 创建带有帧缓冲区的 xlib 窗口,我可以直接绘制并使用 XPutImage

c++ - 使用 std::map 检查字符串是否包含重复项

C++虚函数行为