2015-07-13 28 views
1

我正在开发一个opengl-es应用程序在Linux中。失败请求的主要操作码:1(X_CreateWindow) - Ubuntu

我的系统细节:

的Ubuntu LTS 14.04

64位

英特尔®酷睿™i5-4570 CPU @ 3.20GHz×4

英特尔Haswell的桌面

我初始化egl和opengl为i ñ “http://opengles-book-samples.googlecode.com/svn/trunk/LinuxX11/Common/esUtil.c

与CreateWindow的代码如下

if(!(x11_display = XOpenDisplay(NULL))) 
    { 
     printf("GAL_X11WinCreate:: x11_display == NULL ==> could not open display\n"); 
     return EGL_FALSE; 
    } 
root = DefaultRootWindow(x11_display); 

swa.event_mask = ExposureMask | PointerMotionMask | KeyPressMask; 
win = XCreateWindow(
         x11_display, root, 
         0, 0, iWidth, iHeight, 0, 
         CopyFromParent, InputOutput, 
         CopyFromParent, CWEventMask, 
         &swa 
        ); 

xattr.override_redirect = FALSE; 
XChangeWindowAttributes (x11_display, win, CWOverrideRedirect, &xattr); 

hints.input = TRUE; 
hints.flags = InputHint; 
XSetWMHints(x11_display, win, &hints); 

// make the window visible on the screen 
XMapWindow (x11_display, win); 
XStoreName (x11_display, win, "OGLES_FMWRK"); 

// get identifiers for the provided atom name strings 
wm_state = XInternAtom (x11_display, "_NET_WM_STATE", FALSE); 

memset (&xev, 0, sizeof(xev)); 
xev.type     = ClientMessage; 
xev.xclient.window  = win; 
xev.xclient.message_type = wm_state; 
xev.xclient.format  = 32; 
xev.xclient.data.l[0] = 1; 
xev.xclient.data.l[1] = FALSE; 
XSendEvent (
      x11_display, 
      DefaultRootWindow (x11_display), 
      FALSE, 
      SubstructureNotifyMask, 
      &xev 
      ); 

*hWnd = (EGLNativeWindowType) win; 

我收到以下错误。

 X Error of failed request: BadValue (integer parameter out of range for operation) 
     Major opcode of failed request: 1 (X_CreateWindow) 
     Value in failed request: 0x0 
     Serial number of failed request: 7 
     Current serial number in output stream: 12 

可能是什么问题?

+0

你可以编译并运行HelloTriangle吗? –

回答

0

我得到了类似的错误信息。就我而言。

在Ubuntu 12.04 LTS上可以,但Ubuntu 14.04 LTS。

XSetWindowAttributes xattr; 
xattr.override_redirect = 0; 

我最初的xattr来解决它。

XSetWindowAttributes xattr; 
memset(&xattr,0,sizeof(XSetWindowAttributes)); 
xattr.override_redirect = 0; 

也许它可以帮助你。