AnsweredAssumed Answered

How can I generate FBO in IMX8?

Question asked by wooyeol Jun on Oct 3, 2018
Latest reply on Oct 14, 2018 by igorpadykov

Hi I want to use off-screen rendering in opengles or I want to render to cpu-memory(use rendering result without copy).

I am using Imx8mqevk(wayland).

 

When I generate Frame Buffer Object(FBO) using glGenFramebuffers (GLsizei n, GLuint *framebuffers), the framebuffer IDs are -256, 0, 1635200867. I think the ID should be 1, 2, 3 like texture ID. 

Also, the return value of glCheckFramebufferStatus() is not GL_FRAMEBUFFER_COMPLETE. 

 

below is my code. Could you let me know if I'm wrong or suggest another method for rendering to cpu-memory. 

Thank you.

 

-----------------------------------------------------------------------------------CODE-----------------------------------------------------------------

GLuint fboHandle, depthBuffer, fboTex;
glGenRenderbuffers(1, &depthBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthBuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24_OES, 1280, 720);
glBindRenderbuffer( GL_RENDERBUFFER, 0 );

glGenTextures(1, &fboTex);
glBindTexture(GL_TEXTURE_2D, fboTex);
glTexImage2D( GL_TEXTURE_2D,
0,
GL_RGBA,
1280, 720,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
NULL);
glBindTexture(GL_TEXTURE_2D, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glGenFramebuffers(1, &fboHandle);
cout << "fboHandle: " << fboHandle << endl;
glBindFramebuffer(GL_FRAMEBUFFER, fboHandle);


glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER_APPLE, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, fboTex, 0);
glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER_APPLE, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer);

// FBO status check
GLenum status;
status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
switch(status) {
case GL_FRAMEBUFFER_COMPLETE:
cout<<"fbo complete"<<endl;
break;

case GL_FRAMEBUFFER_UNSUPPORTED:
cout<<"fbo unsupported"<<endl;
break;

default:
/* programming error; will fail on all hardware */
cout<<"Framebuffer Error"<<endl;
break;
}

 

---------------------------------------------------------------------------------------------------------------------------------------------------

Outcomes