|
发表于 2015-10-17 09:45:47
只看该作者
5#
- EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target,
- EGLClientBuffer buffer, const EGLint *attrib_list)
- {
- if (egl_display_t::is_valid(dpy) == EGL_FALSE) {
- return setError(EGL_BAD_DISPLAY, EGL_NO_IMAGE_KHR);
- }
- if (ctx != EGL_NO_CONTEXT) {
- return setError(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
- }
- if (target != EGL_NATIVE_BUFFER_ANDROID) {
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
- ANativeWindowBuffer* native_buffer = (ANativeWindowBuffer*)buffer;
- if (native_buffer->common.magic != ANDROID_NATIVE_BUFFER_MAGIC)
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- if (native_buffer->common.version != sizeof(ANativeWindowBuffer))
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- switch (native_buffer->format) {
- case HAL_PIXEL_FORMAT_RGBA_8888:
- case HAL_PIXEL_FORMAT_RGBX_8888:
- case HAL_PIXEL_FORMAT_RGB_888:
- case HAL_PIXEL_FORMAT_RGB_565:
- case HAL_PIXEL_FORMAT_BGRA_8888:
- break;
- default:
- return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
- native_buffer->common.incRef(&native_buffer->common);
- return (EGLImageKHR)native_buffer;
- }
复制代码
以上是android agl的实现,可以看到EGL_NO_IMAGE_KHR应该是第三第四个参数有问题。第三参数应该在头文件里定义,第四个参数要看库的具体实现了。 |
|