My rendering function is as follows:
void render_renderFrame()
{
#if 1
//Using off-screen rendering here will flash the screen
//Using off-screen rendering here will flash the screen
//Using off-screen rendering here will flash the screen
GLint nDefaultFbo;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &nDefaultFbo);
glBindFramebuffer(GL_FRAMEBUFFER, m_nSvFbo);
DrawOffline(m_tagSvStartPoint);
glBindFramebuffer(GL_FRAMEBUFFER, nDefaultFbo);
float pVerLT[2] = { 0 , 0};
float pVerRB[2] = { 480, 720};
DrawSubtexture(pVerLT, pVerRB, m_nSvTexture);
#else
//Off-screen rendering is not used here, and there will be no flickering screen if you draw directly
//Off-screen rendering is not used here, and there will be no flickering screen if you draw directly
//Off-screen rendering is not used here, and there will be no flickering screen if you draw directly
TagSvIntPoint tagSvStartPoint;
tagSvStartPoint.x = 0;
tagSvStartPoint.y = 0;
float fW = 480;
float fH = 720;
DrawView(tagSvStartPoint,fW,fH);
#endif
}
My FBO is initialized as follows:
void InitFBO()
{
GLenum eStatus;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_nSvDefaultFbo);
glGenTextures(1, &m_nSvTexture);
glBindTexture(GL_TEXTURE_2D, m_nSvTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 480, 720, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);
glGenRenderbuffers(1, &m_nSvDepth);
glBindRenderbuffer(GL_RENDERBUFFER, m_nSvDepth);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 480, 720);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glGenFramebuffers(1, &m_nSvFbo);
glBindFramebuffer(GL_FRAMEBUFFER, m_nSvFbo);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_nSvTexture, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_nSvDepth);
if ((eStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER)) != GL_FRAMEBUFFER_COMPLETE) {
fprintf(stderr, "Offscreen glCheckFramebufferStatus returned error 0x%x... ... \r\n", eStatus);
m_nSvFbo = 0;
return;
}
glBindFramebuffer(GL_FRAMEBUFFER, m_nSvDefaultFbo);
}
My entire rendering process is as follows:
The rendering process in TDA4:
... ...
1. texYuv[i] = appEglWindowGetTexYuv(pEglWindowObj, &texProp[i]);
... ...
2. appEglBindFrameBuffer(glSrvParams->eglWindowObj, &renderTexProp);
Default FBO is used in this function
glGenTextures(1, &tex_obj->tex);
glBindTexture(GL_TEXTURE_2D, tex_obj->tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glGenFramebuffers(1, &tex_obj->fboId);
glBindFramebuffer(GL_FRAMEBUFFER, tex_obj->fboId);
GLuint rboDepthStencil;
glGenRenderbuffers(1, &rboDepthStencil);
glBindRenderbuffer(GL_RENDERBUFFER, rboDepthStencil);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, prop->width, prop->height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rboDepthStencil);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rboDepthStencil);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, tex_obj->tex);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)tex_obj->img);
glBindFramebuffer(GL_FRAMEBUFFER, tex_obj->fboId);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D, tex_obj->tex, 0);
... ...
3. render_renderFrame();
Now the problem is here: if I use a new FBO in render_renderFrame
(not the same as tex_obj->fboId
in appEglBindFrameBuffer
in step 2),
Here it will report 0x506 GL_INVALID_FRAMEBUFFER_OPERATION
error, so nothing can be drawn.
The reason why I use a new FBO here is that I want to draw A first, then draw B, and finally display it as a new texture after processing.
4. glFinish();
glBindFramebuffer(GL_FRAMEBUFFER, 0);
appEglSwap(glSrvParams->eglWindowObj);
Looking forward to your prompt reply, thank you~