Results 1 to 2 of 2

Thread: How can one use EGL with X11?

  1. #1
    Junior Member
    Join Date
    Mar 2011

    How can one use EGL with X11?

    I am trying to use EGL with X11, but I am having some trouble.

    That's the EGL related code. Error checking code has been stripped for brevity:

    Code :
    EGLBoolean CreateEGLContext ( EGLNativeWindowType hWnd, EGLDisplay* eglDisplay,
                                  EGLContext* eglContext, EGLSurface* eglSurface,
                                  EGLint attribList[])
        // Get Display
        display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
        // Initialize EGL
        eglInitialize(display, &majorVersion, &minorVersion)
        // Get configs
        eglGetConfigs(display, NULL, 0, &numConfigs)
        // Choose config
        eglChooseConfig(display, attribList, &config, 1, &numConfigs)
        // Create a surface
        surface = eglCreateWindowSurface(display, config, (EGLNativeWindowType)hWnd, NULL);
        // Create a GL context
        context = eglCreateContext(display, config, EGL_NO_CONTEXT, contextAttribs );
        // Make the context current
        eglMakeCurrent(display, surface, surface, context)
    And it chokes on eglMakeCurrent, throwing a segmentation fault signal and outputting these error messages:

    X Error: code 146 major 135 minor 5: GLXBadDrawable.
    X Error: code 3 major 3 minor 0: BadWindow (invalid Window parameter).
    X Error: code 3 major 3 minor 0: BadWindow (invalid Window parameter).
    Segmentation fault
    Of course one would wonder where's the connection with X11 here? It's in the hWnd, which is obtained from this code:

    Code :
    scr = DefaultScreen(dpy);
    rootwin = RootWindow(dpy, scr);
    cmap = DefaultColormap(dpy, scr);
    win=XCreateSimpleWindow(dpy, rootwin,
            0, 0, esContext->width, esContext->height, 0,
            BlackPixel(dpy, scr), BlackPixel(dpy, scr));
    XStoreName(dpy, win, "opengles2.0");
    gc=XCreateGC(dpy, win, 0, NULL);
    XSetForeground(dpy, gc, WhitePixel(dpy, scr));
    XSelectInput(dpy, win, ExposureMask|ButtonPressMask);
    XMapWindow(dpy, win);
     * Link the windows handle to EGL
    esContext->hWnd = win;
    Now note that if I set hWnd to NULL it does not show an error but just doesn't do anything (i.e. doesn't open a window).

    Any suggestions would be highly appreciated! Thanks!

  2. #2
    Junior Member
    Join Date
    Mar 2011

    Re: How can one use EGL with X11?

    The PVR initialization demo worked. Thanks anyway!

Similar Threads

  1. EGL Binaries for Linux/X11 Systems on TouchPad
    By JeffHoogland in forum EGL
    Replies: 2
    Last Post: 01-11-2012, 10:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean