Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Framenbuffer: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    14

    Framenbuffer: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT

    Hi guys,

    I've been trying to get my application running on someone else's computer, so the code that follows is known to work on my PC, as well as on that of another friend. We both have AMD GPUs.
    The code is however returning a faulty framebuffer on the PC of an NVIDIA user (unsure if manufacturer is a factor here, but mentioning to be sure).
    The status it returns for him is: GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT

    The purpose of this code is to generate a framebuffer with a texture array (GL_TEXTURE_2D_ARRAY) in order to generate cascades for shadowmapping.
    m_fbo is a GLuint to store the framebuffer, m_shadowMap is a GLuint to store the shadowMap texture array.
    windowWidth and windowHeight are positive integers.

    I've not had much luck searching the internet for similar problems using GL_TEXTURE_2D_ARRAY, so I've taken to the forums.
    My question is thus: am I doing certain steps incorrectly, possibly in the wrong order?

    Any suggestions are greatly appreciated!

    Thanks in advance,
    Lodeman

    Code :
    bool ShadowMapFBO::init(unsigned int windowWidth, unsigned int windowHeight)
    {
        // Create the FBO
        glGenFramebuffers(1, &m_fbo);    
     
        // Create the depth buffer
        glGenTextures(1, &m_shadowMap);
    	glBindTexture(GL_TEXTURE_2D_ARRAY, m_shadowMap);
     
    	glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_DEPTH_COMPONENT16, windowWidth, windowHeight, NUM_CASCADES, GL_FALSE, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, 0);
    	glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_CLAMP);
        glTexParameterf(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_CLAMP);
        glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE);
        glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL);
        glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY);
     
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo);
    	glFramebufferTexture3D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D_ARRAY, m_shadowMap, 0, 0);
    	for(int i = 0; i < NUM_CASCADES; ++i)
    	{
    		glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_shadowMap, 0, i);
    	}
     
     
    	// Disable writes to the color buffer
        glDrawBuffer(GL_NONE);
     
        GLenum Status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
     
        if (Status != GL_FRAMEBUFFER_COMPLETE) {
    		MessageBox(NULL, "Failed to create ShadowMapFBO, status: "+Status, "Heavy times", MB_ICONERROR | MB_OK); 
            Debug::printDebugTextWithInt("Failed to create ShadowMapFBO, status: ", Status);
            return false;
        }
     
    	Debug::printDebugText("Succesfully created ShadowMapFBO");
        return true;
    }

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,124
    Quote Originally Posted by Lodeman View Post
    Code cpp:
    ...
        glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo);
        glFramebufferTexture3D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D_ARRAY, m_shadowMap, 0, 0);
        for(int i = 0; i < NUM_CASCADES; ++i)
        {
            glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_shadowMap, 0, i);
        }

    I think you want to nuke the glFramebufferTexture3D() as this is for 3D textures only IIRC. Just keep the glFramebufferTextureLayer() to bind the specific layer you're rendering to.

    Also would check for GL errors, and verify that m_shadowMap is not 0 when you set it on the FBO.
    Last edited by Dark Photon; 12-19-2013 at 07:53 PM.

  3. #3
    Junior Member Newbie
    Join Date
    Feb 2013
    Posts
    14
    Hi Dark Photon,

    It took me awhile to get around to testing this solution with the specific people, but we got it to work.
    Alongside removing the glFrameBufferTexture3D() we also had to make sure the app was running with their dedicated 3D Graphics card, as it turned out to be running with the onboard mobo one.

    Thanks for your help!

Posting Permissions

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