How to buffer frames in GPU and use them as textures in the future render processing

hi,everyone, what I want to do is buffer 15 frames from camera as texture into GPU, which I will use in the future rendering processing. For Android device, I follow the code of grafika, frame data transfer from camera preview to SurfaceTexture, then flow to specific Texture id in OpenGL. I try the following ways:

  1. I create 15 offscreen EGLsurface(Pbuffer), and put render different frame data to these Pbuffer. but I don’t know how to use these Pbuffer as texture in the following render processing.
  2. I try to use FBO to copy texture data from different texture id, but since I get texture from camera, the texture type is like GLES11Ext.GL_TEXTURE_EXTERNAL_OES, and the function glFramebufferTexture2D need use GLES20.GL_TEXTURE_2D, I don’t know how to transfer data type between these two types.

So How can I do to buffer frames in GPU and use them as textures in the future render processing.

Any suggestions are welcome! Thanks!

why dont you creare 15 textures ?
and when you want to fill datainto a certain texture, attach it to your framebuffer and render into it

later when you want to read from a certain texture, bind it to any texture unit and sample from it as you would normally do
but make sure you dont read and write into the same texture simultaneously

[QUOTE=john_connor;1284198]why dont you creare 15 textures ?
attach it to your framebuffer and render into it

Thanks for your replay!
yes, I generate several textures and want to attach them to framebuffer, since I should use function
glFramebufferTexture2D(GLenum target,
GLenum attachment,
GLenum textarget,
GLuint texture,
GLint level);

to attach texture to framebuffer.
The parameter “textarget” should be GL_TEXTURE_2D, but in my case, the texture target come from camera is GL_TEXTURE_EXTERNAL_OES, which is not accepted in this function. How can I do?

My guess is that you should convert from this external oes format into a more common format.
A quick google search led me to that this format is generally a YUV format. You’ll need a RGB-kind format. Here is an example on how the conversion works.

The framebuffer texture needs to be a RGB/RGBA texture.

You reference the image as a texture using glEGLImageTargetTexture2DOES(), then bind the texture to a texture unit using the GL_TEXTURE_EXTERNAL_OES target, then access it from within the fragment using a uniform variable of type samplerExternalOES. The implementation will perform any YUV to RGB conversion, but it won’t perform any gamma correction; if that’s required, it needs to be done in the shader (and any interpolation will be performed in the original colour space).