Can not connect a Surface eglCreatePbufferFromClientBuffer

76 Views Asked by At
    VGint num_config;
    EGLint value;
    EGLBoolean ret;
    
    m_BackLayerBuffer = vgCreateImage(SGA_DIS_FMT_RGB565, LCD_WIDTH, LCD_HEIGHT, VG_IMAGE_QUALITY_NONANTIALIASED);
    vgClearImage(m_BackLayerBuffer, 0, 0, LCD_WIDTH, LCD_HEIGHT);
    
    m_Context = eglGetCurrentContext();
    m_Display = eglGetCurrentDisplay();
    eglGetConfigs(m_Display, NULL, NULL, &num_config);
    m_DrawSurface = eglGetCurrentSurface(EGL_DRAW);     
    
    ret = eglChooseConfig(m_Display, attribute_list, &m_Config, 1, &num_config);

    m_OffScreenContext = eglCreateContext(m_Display, m_Config, EGL_NO_CONTEXT, NULL);
    m_ImageSurface = eglCreatePbufferFromClientBuffer(m_Display, EGL_OPENVG_IMAGE, (EGLClientBuffer)m_BackLayerBuffer, m_Config, NULL);
    
    value = eglGetError();
    ret = eglMakeCurrent(m_Display, m_ImageSurface, m_ImageSurface, m_OffScreenContext);

m_ImageSurface always 0, and the error is EGL_BAD_ACCESS. the config is error?

1

There are 1 best solutions below

0
On BEST ANSWER

I know that, this hardware can not supoort muti context. After I delete

m_OffScreenContext = eglCreateContext(m_Display, m_Config, EGL_NO_CONTEXT, NULL);

the return value is EGL_SUCCESS