OpenCV Matrix with OpenGLTexture setData
-
I have been trying to pass the OpenCV Matrix (converted BGR to RGB) data to OpenGLTexture(ES 2.0) setData but unable to display the texture.
Here is code for same
texture = new QOpenGLTexture(QOpenGLTexture::Target2D);
uploadPixel.setAlignment(1);
texture->setFormat(QOpenGLTexture::RGBA8_UNorm); (Also tried RGBAFormat for OpenGL ES 2.0)
texture->setSize(mOrigImage.cols,mOrigImage.rows);
texture->allocateStorage();
texture->setData(QOpenGLTexture::RGBA,QOpenGLTexture::UInt8,mOrigImage.data,&uploadPixel);
texture->setMinificationFilter(QOpenGLTexture::Nearest);
texture->setMagnificationFilter(QOpenGLTexture::Linear);I think, some issue with internal Texture with set format or the pixel format and type. So anyone tell me the correct Pixel Format and Type for OpenCV matrix?