Results 1 to 2 of 2

Thread: Always get EGL_BAD_MATCH when using eglCreatePixmapSurface

  1. #1
    Junior Member
    Join Date
    Apr 2011
    Posts
    2

    Always get EGL_BAD_MATCH when using eglCreatePixmapSurface

    Recently, I was trying to attach a 3D module to an exiting picture and then show it on the window, but when I try to use eglCreatePixmapSurface, always get the EGL_BAD_MATCH error, here is the code, OS is WINCE5.0 with opengles 1.3:

    BOOL CModelWnd2::CreateViewGLContext(HDC hDC)
    {

    m_dpy = eglGetDisplay( (NativeDisplayType) m_hDC);
    if ( ! m_dpy )
    return false;

    if ( eglInitialize(m_dpy, NULL, NULL) == EGL_FALSE )
    {
    return false;
    }

    // choose config
    EGLint cfg_attr_list[] = { EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
    EGL_RED_SIZE, 4,
    EGL_GREEN_SIZE, 4,
    EGL_BLUE_SIZE, 4,
    EGL_BUFFER_SIZE, 16,
    EGL_DEPTH_SIZE, 16,
    EGL_NATIVE_RENDERABLE, EGL_TRUE,
    EGL_NONE
    };

    __int32 num = 0;
    if ( eglChooseConfig(m_dpy, cfg_attr_list, &m_config, 1, &num) == EGL_FALSE || num == 0 )
    {
    return false;
    }

    // create surface
    m_surface = eglCreatePixmapSurface(m_dpy, m_config, m_hDib, 0);//m_hDib has been created in advance
    if (m_surface == EGL_NO_SURFACE )
    {
    int nResult = eglGetError();//always get EGL_BAD_MATCH
    return false;
    }

    // create context
    m_hGLContext = eglCreateContext(m_dpy, m_config, NULL, NULL);
    // active context (make current)
    if(m_hGLContext==NULL)
    return FALSE;

    if(eglMakeCurrent(m_dpy, m_surface, m_surface, m_hGLContext)==FALSE)
    return FALSE;

    return TRUE;
    }

    any answer or clue will be highly appreciated.

  2. #2
    Junior Member
    Join Date
    Apr 2011
    Posts
    2

    Re: Always get EGL_BAD_MATCH when using eglCreatePixmapSurfa

    I've found the sourcecode of eglCreatePixmapSurface yesterday, it turned out that I can't use it on WINCE platform:

    GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list) {
    // Cannot support rendering to arbitrary native surfaces; use pbuffer surface and eglCopySurfaces instead
    eglRecordError(EGL_BAD_MATCH);
    return EGL_NO_SURFACE;
    }

    So, I decided to use pbuffer surface and eglCopySurfaces instead, if I get any further progress, I'll update this thread.

Similar Threads

  1. eglCreateWindowSurface fails with EGL_BAD_MATCH
    By Teraslilja in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 0
    Last Post: 05-12-2011, 08:03 AM
  2. Problem using eglCreatePixmapSurface
    By siddy_tow in forum OpenGL ES general technical discussions
    Replies: 0
    Last Post: 08-26-2008, 02:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •