I want to convert my yuv420 image into rgb888 image. i got below link for this. http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c
This program works fine for me. Now i want to read back my processed rgb data from GPU into host memory. i have tried to do glGetTexImage but it gives me only last binded texture data.
Can any one tell how can i read back my processed RGB data from GPU into host memory?
I also have another question that if i will get success to read back my data from GPU into host memory then it will be RGB or RGBA?
Use the glReadPixels
command. The syntax is `glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid * data)
x
and y
specify the location of the lower left corner of the rectangle you to read from thr framebuffer, format
accepts GL_ALPHA
, GL_RGB
, and GL_RGBA
, type
is the type of the pixel data, data
is a pointer to the returned data array.
format
specifies if the data will be RGB, RGBA or alpha.
You can get more information at the Khronos specification page.