如何创建一个与EGL display兼容的DC或者bitmap

Mario_Q 2014-03-09 10:09:38
memdc = CreateCompatibleDC( (HDC)display );
bitmap = CreateCompatibleBitmap((HDC)display, width, height);
这两个老是创建失败。,不知道是什么原因
EGL的初始化如下
EGLint config_list[] = {
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
#if defined(OPENGLES_TEST)
EGL_DEPTH_SIZE, 24,
#endif
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!\r\n");
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!\r\n");
return ;
}

context = eglCreateContext( display, config, NULL, NULL );
if ( context == EGL_NO_CONTEXT || eglGetError() != EGL_SUCCESS )
{
printf("eglCreateContext Error!\r\n");
return ;
}

if ( eglMakeCurrent( display, surface, surface, context ) == EGL_FALSE || eglGetError() != EGL_SUCCESS )
{
printf("eglMakeCurrent Error!\r\n");
return;
}

配置改成
EGLint config_list[] = {
EGL_NONE
};
也不行
...全文
235 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧