Hi,I am new to EGL and I want to bind the camera’s buffer to the texture on the QNX system (not Android,zero copy).
My steps are as follows:
#include <EGL/eglext.h>
#define EGL_EGLEXT_PROTOTYPES
extern PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
.......
EGLint eglImgAttrsout[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE, EGL_NONE };
EGLImageKHR imgout_record = eglCreateImageKHR(egl_disp,
EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)vir_buffer[frame_info.idx], eglImgAttrsout);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, imgout_record);
This code can be compiled, but an error is reported when running:
terminated SIGBUS code=1 fltno=5 ip=910003fda9bc7bfd
Bus error (core dumped)
The program crashes when it runs to eglCreateImageKHR
In order to eliminate the problem of buffer format, I used opencv to read the image and convert it to rgba, but it still crashed
cv::Mat img = cv::imread("xxxxxxx");
uchar* camData = new uchar[img.total() * 4];
cv::Mat continuousRGBA(img.size(), CV_8UC4, camData);
cv::cvtColor(img, continuousRGBA, CV_BGR2RGBA, 4);
......................
EGLImageKHR imgout_record = eglCreateImageKHR(egl_disp,
EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
(EGLClientBuffer)continuousRGBA.data, eglImgAttrsout);
Does anyone know why it crashes, or is there any other way to bind the camera buffer to the texture?