19,468
社区成员
发帖
与我相关
我的任务
分享
EGLDisplay eglDisplay= 0;
EGLConfig eglConfig = 0;
EGLSurface eglSurface= 0;
EGLContext eglContext= 0;
EGLNativeWindowType eglWindow = 0;
EGLNativePixmapType system_pixmap = 0;
void initEGL(){
eglDisplay = eglGetDisplay(NULL);
EGLint iMajorVersion, iMinorVersion;
eglInitialize(eglDisplay, NULL,NULL);
eglBindAPI(EGL_OPENGL_ES_API);
EGLint pi32ConfigAttribs[] =
{
EGL_ALPHA_SIZE, 0,
EGL_RED_SIZE, 5,
EGL_GREEN_SIZE, 6,
EGL_BLUE_SIZE, 5,
EGL_DEPTH_SIZE, 16,
EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
EGL_NONE
};
int iConfigs;
eglChooseConfig(eglDisplay, pi32ConfigAttribs, &eglConfig, 1, &iConfigs);
eglSurface = eglCreatePixmapSurface(eglDisplay, eglConfig, system_pixmap,NULL);
EGLint ai32ContextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE };
eglContext = eglCreateContext(eglDisplay, eglConfig, NULL, ai32ContextAttribs);
eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
}