// 创建eglSurface
eglSurface_ = eglCreateWindowSurface(eglDisplay_, config_, eglNativeWindow_, context_attribs);
按照文档来创建一个surface,函数报错。
解决方案:
从报错中可以看出eglCreateWindowSurface函数的第三个入参类型错误,从egl.h头文件中可知,第三个入参应为EGLNativeWindowType而非OHNativeWindow *,通过文档中上文可知eglNativeWindow\_的定义部分类型出现了问题,文档中为:OHNativeWindow *eglNativeWindow\_;
参考如下修改:
/ 从XComponent中获取到的OHNativeWindow
EGLNativeWindowType *eglNativeWindow_;
...
// 创建eglSurface
eglsurface_ = eglCreateWindowSurface(eglDisplay_, config_, *eglNativeWindow_, context_attribs);