|
|

楼主 |
发表于 2009-1-21 10:12:00
|
显示全部楼层
Re:请教:glXCreateWindow产生failed to create drawable的原因
我测试了即使最简单的glx程序也会发生错误。
下面是代码:
#include <X11/Xlib.h>
#include <GL/glx.h>
int main()
{
Display *dsp = XOpenDisplay(0);
int n;
GLXFBConfig *fbcfg = glXChooseFBConfig(dsp, DefaultScreen(dsp), 0, &n);
XVisualInfo *vis = glXGetVisualFromFBConfig(dsp, *fbcfg);
GLXContext con = glXCreateNewContext(dsp, *fbcfg, GLX_RGBA_TYPE, 0, GL_TRUE);
XSetWindowAttributes setwa;
setwa.colormap = XCreateColormap(dsp, RootWindow(dsp, vis->screen), vis->visual, AllocNone);
setwa.border_pixel = 0;
setwa.event_mask = StructureNotifyMask;
Window win = XCreateWindow(
dsp, RootWindow(dsp, vis->screen),
0 /* x */, 0 /* y */, 320 /* width */, 240 /* height */, 0 /* border width*/,
vis->depth /* depth */, InputOutput, vis->visual,
CWBorderPixel | CWEventMask | CWColormap, &setwa);
XMapWindow(dsp, win); // assign window to our Display
GLXWindow glxwin = glXCreateWindow(dsp, *fbcfg, win, 0);
glXMakeContextCurrent(dsp, glxwin, glxwin, con);
return 0;
}
然后是产生的错误报告:
failed to create drawable
X Error of failed request: BadDrawable (invalid Pixmap or Window parameter)
Major opcode of failed request: 55 (X_CreateGC)
Resource id in failed request: 0x4200004
Serial number of failed request: 21
Current serial number in output stream: 23
|
|