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.