2

So i am trying to create a FrameBuffer where i render to a texture, but i can't seem to get it to work with the format i need. That is GL_RGB32F. It works for GL_RGB16F and GL_RGBA32F so i don't understand why GL_RGB32F is giving me GL_FRAMEBUFFER_INCOMEPLETE_ATTACHMENT from glCheckFramebufferStatus. I get no errors from the calls creating the texture either. Is there a special requirement to use that internal format? Can i see if i have support for it?

glGenFramebuffers(1, &fbo);
glBindFramebuffer(GL_FRAMEBUFFER, fbo);

glGenTextures(1, &positionTexture);
    glBindTexture(GL_TEXTURE_2D, positionTexture);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, height, 0, GL_RGB, GL_FLOAT, nullptr);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, positionTexture, 0);

1 Answer 1

5

GL_RGB16F andGL_RGB32F are not required color buffer formats in the GL, while GL_RGBA32F is. You can have a look in Table 8.12 of the OpenGL 4.5 core profile specification (pages 198-200, assuming june 2017 revision of said document). It tells you that all these mentioned formats are color renderable but only GL_RGBA32F out of that set is a required render format. Implementations might support the other ones optionally, but you can't rely on that.

Sign up to request clarification or add additional context in comments.

2 Comments

Your reference to Table 8.13 and corresponding page numbers seem off. Table 8.13 doesn't even mention RGBA32F. Did you mean 8.12 on pages 198—200?
@Ruslan: hmm, yes, thanks for the hint. According to appendix H.3 of the current 4.5 core spec, the document has ondergone 3 revisions after december 2015 when this answer was written... I still have a local copy of the August 2014 revision here, where the numbers are correct... Unfortunately, khronos just replaces the official spec documents with the newest revision, so that such de-syncs are very likely to happen... I think the gl specs are on a github repo now, so maybe it is better to link to a specific commit there...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.