Other Parts Discussed in Thread: TDA2
Use off-screen rendering on TDA4 to report 0x506 error GL_INVALID_FRAMEBUFFER_OPERATION.
QNX system, SDK version 7.3~
The same off-screen rendering is OK on TDA2 based on Linux system 3.7 and 3.8SDK. You said that TDA4 is supported, and the below is to implement the basic code.
Help analyze it. If you need to provide other supplements, please point out~
code show as below:
//initialization
void SvEglRenderBase::InitFrameBufferOpt()
{
//Create frame buffer object: FBO
glGenFramebuffers(1, &m_nSvTopviewFbo);
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_nSvDefaultFbo);
glBindFramebuffer(GL_FRAMEBUFFER, m_nSvTopviewFbo);
int nTestId;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &nTestId);
//Create offline render texture
glGenTextures(1, &m_nSvTopviewTexture);
glBindTexture(GL_TEXTURE_2D, m_nSvTopviewTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SV_2D_LUT_WIDTH, SV_2D_LUT_HEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
//Setting Texture Parameters: Interpolation method. The interpolation methods of the farthest and nearest can be set differently.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//Binding 2D texture to default texture is generally used to break the previous texture binding relationship
//and restore the texture binding state of OpenGL to the default state.
glBindTexture(GL_TEXTURE_2D, 0);
//Bind textrue to FBO
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_nSvTopviewTexture, 0);
glBindFramebuffer(GL_FRAMEBUFFER, m_nSvDefaultFbo);
//Create frame buffer object: FBO
glGenFramebuffers(1, &m_nSvPart3dFbo);
//Create offline render texture
glGenTextures(1, &m_nSvPart3dTexture);
//If 3D off-screen rendering is required, depth Buffer is required here
glGenRenderbuffers(1, &m_nSvPart3dDepthId);
//Bind FBO: To use FBO, it must be bind firstly. Make it the current rendering buffer.
glBindFramebuffer(GL_FRAMEBUFFER, m_nSvPart3dFbo);
//Create offline render texture: Texture must be created befroe it is bind to FBO
glBindTexture(GL_TEXTURE_2D, m_nSvPart3dTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, SV_3D_VIEW_WIDTH, SV_3D_VIEW_HEIGHT,0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
//Setting Texture Parameters: Interpolation method. The interpolation methods of the farthest and nearest can be set differently.
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
//Binding 2D texture to default texture is generally used to break the previous texture binding relationship
//and restore the texture binding state of OpenGL to the default state.
glBindTexture(GL_TEXTURE_2D, 0);
//Bind textrue to FBO
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_nSvPart3dTexture, 0);
glBindRenderbuffer(GL_RENDERBUFFER, m_nSvPart3dDepthId);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, SV_3D_VIEW_WIDTH, SV_3D_VIEW_HEIGHT);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_nSvPart3dDepthId);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, m_nSvDefaultFbo);
//Type 0 in TDA4
//Type 0 in TDA4
//Type 0 in TDA4
//Type 0 in TDA4
GLenum eErrStatus = glCheckFramebufferStatus(GL_FRAMEBUFFER);
printf("[AVM] glCheckFramebufferStatus complete eErrStatus = 0x%x.\n",eErrStatus);
if(eErrStatus != GL_FRAMEBUFFER_COMPLETE)
{
switch(eErrStatus)
{
case GL_FRAMEBUFFER_COMPLETE:
printf("[AVM] Framebuffer complete.\n");
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
printf("[AVM] [ERROR] Framebuffer incomplete: Attachment is NOT complete.\n");
break;
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
printf("[AVM] [ERROR] Framebuffer incomplete: No image is attached to FBO.\n");
break;
case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
printf("[AVM] [ERROR] Framebuffer incomplete: Attached images have different dimensions.\n");
break;
case GL_FRAMEBUFFER_UNSUPPORTED:
printf("[AVM] [ERROR] Unsupported by FBO implementation.\n");
break;
default:
printf("[AVM] [ERROR] Unknow error.\n");
break;
}
}
}
//Rendering and drawing
glBindFramebuffer(GL_FRAMEBUFFER, m_pEGLRenderBase->m_nSvTopviewFbo);
DrawOffline1();
DrawOffline2();
DrawOffline3();
glBindFramebuffer(GL_FRAMEBUFFER, m_pEGLRenderBase->m_nSvDefaultFbo);
DrawAll();
//Report 0x506 error here GL_INVALID_FRAMEBUFFER_OPERATION
GLenum nErrId = glGetError();
if (nErrId != GL_NO_ERROR
Help analyze it. If you need to provide other supplements, please point out~
Please~
Thanks~