@dbisig wrote:
Hi all,
I'm currently facing a problem when trying to attach multiple textures to a single framebuffer object via the attachTexture function. My bare bone codes for doing this is as follows:
std::array<int, 2> frameBufferSize = {1280, 720}; mColorTexture.allocate(frameBufferSize[0], frameBufferSize[1], GL_RGBA16F); mBrightTexture1.allocate(frameBufferSize[0], frameBufferSize[1], GL_RGBA16F); mColorBrightFbo.allocate(frameBufferSize[0], frameBufferSize[1], GL_RGBA16F); mColorBrightFbo.attachTexture(mColorTexture, GL_RGBA16F, 0); mColorBrightFbo.attachTexture(mBrightTexture1, GL_RGBA16F, 1);During the later shading stages, I can't render into the second attached texture.
When looking at the source code for the ofFbo class, I notice that the attachTexture member function doesn't extend the activeDrawBuffers member variable ( contrary to the createAndAttachTexture function ). To circumvent this problem, I've resorted to the following (temporary) hack: I moved the activeDrawBuffers member variable to the public section of the ofFbo class. This allows me to manually extend the activeDrawBuffers with the following to calls:
mColorBrightFbo.activeDrawBuffers.push_back(GL_COLOR_ATTACHMENT0 + 0); mColorBrightFbo.activeDrawBuffers.push_back(GL_COLOR_ATTACHMENT0 + 1);Doing so fixes the problem that I couldn't render into the second texture.
I'm now wondering if this behaviour is a bug or if I'm using the ofFbo class in an incorrect manner.
I greatly appreciate any advice about this.
Best regards
Daniel
Posts: 8
Participants: 2