This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: [TDA4 OpenGL] fbo usage

Part Number: TDA4VM

When I create fbo, use the glBindTexture, which enum to use?GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES?

If I use the GL_TEXTURE_2D, create fbo will success, but when run the application, will report PVR errors:(1002) PVR:(Error): IsTextureConsistent: IMGEGLImage is not consistent [ :0 ];

if I use the GL_TEXTURE_EXTERNAL_OES, create fbo will fail, glGetError() return the GL_INVALID_ENUM;

How can i do?

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

    glGenTextures(1, &_uiColorBuffer1);
    glBindTexture(GL_TEXTURE_2D, _uiColorBuffer1);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, /*SingleViewParamter::_width*/458, SingleViewParamter::_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _uiColorBuffer1, 0);
    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
    {
        printf("[hcl] -- glCheckFramebufferStatus colorbuffer 1 error!\n");
    }

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

    glGenTextures(1, &_uiColorBuffer1);
    glBindTexture(GL_TEXTURE_EXTERNAL_OES, _uiColorBuffer1);
    glTexImage2D(GL_TEXTURE_EXTERNAL_OES, 0, GL_RGB, /*SingleViewParamter::_width*/458, SingleViewParamter::_height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
    glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_EXTERNAL_OES, _uiColorBuffer1, 0);
    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
    {
        printf("[hcl] -- glCheckFramebufferStatus colorbuffer 1 error!\n");
    }

  • hello ?

    Is any update?

  • hello, I create fbo success.

    but how can i use the texture attachment?

    when i bind it using GL_TEXTURE_EXTERNAL_OES,  then glDrawElements failed, glerror returns 1282;

    when i bind it using GL_TEXTURE_2D, then glDrawElements success, but nothing to been showed, and also have pvr error;

    how can i use the texture attachment?

    regards.

  • Hello,

    The following two work for me:

    glGetIntegerv(GL_FRAMEBUFFER_BINDING, &current_fbo);

    glActiveTexture(GL_TEXTURE15);
    glGenTextures(1, &offscreen_fbo_texture);
    glBindTexture(GL_TEXTURE_2D, offscreen_fbo_texture);
    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_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, 0);

    /* Depth buffer */
    glGenRenderbuffers(1, &offscreen_fbo_depth);
    glBindRenderbuffer(GL_RENDERBUFFER, offscreen_fbo_depth);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
    glBindRenderbuffer(GL_RENDERBUFFER, 0);

    /* Framebuffer */
    glGenFramebuffers(1, &offscreen_fbo);
    glBindFramebuffer(GL_FRAMEBUFFER, offscreen_fbo);
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, offscreen_fbo_texture, 0);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, offscreen_fbo_depth);

    if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {

    // Error

    }
    glBindFramebuffer(GL_FRAMEBUFFER, current_fbo);

    Regards

    Hemant

  • hello hemant:

    thanks for your reply.

    I known this is the way to create fbo, I have been done it on windows, and it works right.

    my question is how to use it on TDA4.

    on TDA4:

    I create a texture attachment and attach it to my fbo.

    and use glEGLImageTargetTexture2DOES instead of glTexImage2D,

    this way can create fbo success and be show.

    but when i use the texture attachment, the error happened.

    1.when i use GL_TEXTURE_EXTERNAL_OES to bind my texture attachment, the glBindTexture error, glGetError returns GL_INVALID_OPERATION;

    2.when i use GL_TEXTURE_2D to bind my texture attachment, the glBindTexture successd., but have pvr errors, and nothing to been showed.

    how can i use the texture attachment on TDA4?

    regards.

  • Hello,

    Apologies for the late response. Are you still facing this problem? If so, can you specify what you are trying to achieve. There are some restrictions that may apply on how TEXTURE_EXTERNAL_OES is used.

    Regards

    Hemant