我正在编写与此非常相似的代码:
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/