Results 1 to 3 of 3

Thread: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES - Android NDK

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    1

    GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES - Android NDK

    I'm having problem with OpenGL ES 1.x rendering engine on my Nexus 7 - I'm trying to create frame buffer but it always return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES no matter what, the code is as shown below:

    Code :
    #ifdef __ANDROID__
    glGenFramebuffersOES(1, &gameSurfaceFrameBuffer);	
    #else
    glGenFramebuffers(1, &gameSurfaceFrameBuffer);
    #endif
     
    #ifdef __ANDROID__
    glBindFramebufferOES(GL_FRAMEBUFFER_OES, gameSurfaceFrameBuffer);
    #else
    glBindFramebuffer(GL_FRAMEBUFFER, gameSurfaceFrameBuffer);
    #endif
     
    glGenTextures(1, &gameSurfaceTexture);
    glBindTexture(GL_TEXTURE_2D, gameSurfaceTexture);
     
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
     
    glTexImage2D(GL_TEXTURE_2D, 0, 4, 48 * 14, 48 * 12, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
     
    #ifdef __ANDROID__
    glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, gameSurfaceTexture, 0);
    #else
    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gameSurfaceTexture, 0);
    #endif
     
    #ifdef __ANDROID__
    GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES);
    #else
    GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    #endif
     
    #ifdef __ANDROID__
    if(status != GL_FRAMEBUFFER_COMPLETE_OES){
    #else
    if(status != GL_FRAMEBUFFER_COMPLETE){
    #endif
    	std::stringstream ss;
    	ss << "gameSurfaceFrameBuffer, status != GL_FRAMEBUFFER_COMPLETE ";
    	ss << "status = " << status;
    	throw ss.str();
    	}
    }

    As you can see I have the code for both Android and normal OpenGL - the code works on Windows just fine but on Android it returns incomplete attachment.

    I took the code to create EGL surface from native-activity sample, maybe it's something about that which doesn't allow me to create the buffer?

  2. #2

    Re: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES - Android NDK

    check the 3rd parameter you are passing to glTeximage2D, it should be internal format.
    Also, try creating renderbuffer and attach depth attachement to framebuffer.

  3. #3
    Member
    Join Date
    Jun 2012
    Location
    Texas
    Posts
    61

    Re: GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES - Android NDK

    The 3rd parameter to glTexImage2D() must be one of these for Android:

    /* PixelFormat */
    #define GL_ALPHA 0x1906
    #define GL_RGB 0x1907
    #define GL_RGBA 0x1908
    #define GL_LUMINANCE 0x1909
    #define GL_LUMINANCE_ALPHA 0x190A

    Regards, Clay

Similar Threads

  1. EGLImage on Android NDK
    By smiyax73 in forum OpenGL ES general technical discussions
    Replies: 2
    Last Post: 01-20-2013, 12:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •