External Texture Image
How to use EGLKHRExternalTexture
To use an DMA buffer as an external texture create an array to hold necessary information. This varies with platforms and types of buffers. This example shows using DMS buffers on RCarH3.
//Activate appropriate RenderTarget first. EGLint defaultAttribs[13]; defaultAttribs[0] = EGL_DMA_BUF_PLANE0_FD_EXT; defaultAttribs[1] = <file descriptor of the buffer>; //file descriptor defaultAttribs[2] = EGL_DMA_BUF_PLANE0_OFFSET_EXT; defaultAttribs[3] = 0; // depends on platform and requirements defaultAttribs[4] = EGL_DMA_BUF_PLANE0_PITCH_EXT; defaultAttribs[5] = <pitch of the buffer>; defaultAttribs[6] = EGL_LINUX_DRM_FOURCC_EXT; defaultAttribs[7] = DRM_FORMAT_ARGB8888; // depends on platform and requirements defaultAttribs[8] = EGL_WIDTH; defaultAttribs[9] = 255; // width of the image. Also set this to the EglKhrExternalTextureImage defaultAttribs[10] = EGL_HEIGHT; defaultAttribs[11] = 456; // height of the image. Also set this to the EglKhrExternalTextureImage defaultAttribs[12] = EGL_NONE; //Terminator Candera::EglKhrExternalTextureImage::SharedPointer ptr = Candera::EglKhrExternalTextureImage::Create(); ptr->SetRole(<Candera::EglKhrExternalTextureImage::Consumer| Candera::EglKhrExternalTextureImage::Producer>); //Can only be set once on purpose! Use producer to render to this buffer and consumer if it shall be used as texture. ptr->SetAttributeList(defaultAttribs); // will be deep copied. ptr->SetExternalBufferType(EGL_LINUX_DMA_BUF_EXT); // buffer type ptr->SetExternalBuffer(static_cast<EGLClientBuffer>(0)); // actual buffer ptr->SetWidth(255); ptr->SetHeight(456); ptr->Upload();