I have a OpenGL ES 2.0 QNX application that uses camera input, makes some processing and renders something to screen.
All my shaders take GL_TEXTURE_EXTERNAL_OES texture from the camera as input and it's format is YUV422.
I want to test my application on the target platform (QNX) using RGB images in png format.
The question is: how can I create GL_TEXTURE_EXTERNAL_OES texture from RGB image to emulate the input from the camera for my application?
Answering own question.
Steps to create GL_TEXTURE_EXTERNAL_OES texture from RGB buffer on QNX.
1.Converting RGB to YUV422 format on CPU
2.Creating pixmap buffer using screen
EGLNativePixmapType pObjEglPixmap = ...
3.Binding pixmap to GL_TEXTURE_EXTERNAL_OES texture using EGLImageKHR object
EGLImageKHR pObjTextureEglImage = eglCreateImageKHR(eglDisplay,
EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR,
pObjEglPixmap,
NULL);
GLuint pObjTextureId;
glGenTextures(1, &pObjTextureId);
glBindTexture(GL_TEXTURE_EXTERNAL_OES, pObjTextureId);
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES,
(GLeglImageOES)pObjTextureEglImage);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With