Environment : WinCE
i’d like to copy the windows HDC to EGL.
GLint config_list[] = {
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_NONE
};
EGLint num_config;
g_dpy = GetDC(gHWND);
display = eglGetDisplay(g_dpy);
if (eglInitialize(display, NULL, NULL) == EGL_FALSE || eglGetError() != EGL_SUCCESS)
{
printf("eglInitialize Error!
");
return;
}
eglChooseConfig(display, config_list, &config, 1, &num_config);
eglBindAPI(EGL_OPENGL_ES_API);
surface = eglCreateWindowSurface( display, config, (NativeWindowType)(gHWND) , NULL);
if ( surface == EGL_NO_SURFACE || eglGetError() != EGL_SUCCESS )
{
printf("eglCreateWindowSurface Error!
");
return ;
}
context = eglCreateContext( display, config, NULL, NULL );
if ( context == EGL_NO_CONTEXT || eglGetError() != EGL_SUCCESS )
{
printf("eglCreateContext Error!
");
return ;
}
if ( eglMakeCurrent( display, surface, surface, context ) == EGL_FALSE || eglGetError() != EGL_SUCCESS )
{
printf("eglMakeCurrent Error!
");
return;
}
then
HDC memdc = CreateCompatibleDC( (HDC)display );
HBITMAP bitmap = CreateCompatibleBitmap((HDC)display, width, height);
SelectObject( memdc, bitmap );
…draw something
BitBlt( (HDC)display, 0, 0, width, height, memdc, 0, 0, SRCCOPY );
it dosen’t work. memdc and hbitmap always 0x000000.
help me. thansk