• Advertisement
Sign in to follow this  

Render to 3D Texture

This topic is 2875 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i try to render with a FBO into a 3D Texture without success.
int layers = 128
glGenFramebuffers(1, &this->framebufferObjectVolume);
glBindFramebuffer(GL_FRAMEBUFFER, this->framebufferObjectVolume);
    this->orthoProjection->startOrthoWithGlu();
    for (int i = 0; i < layers; i++) {
        glFramebufferTexture3D(GL_FRAMEBUFFER, GL_TEXTURE_3D, GL_COLOR_ATTACHMENT0+i, this->textureController->getTexture("tex3d")->getHandler(), 0, i);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        drawFullscreenQuad();
    }            
    this->orthoProjection->endOrthoWithGlu();

Can someone tell me what i do wrong? Thank you element

Share this post


Link to post
Share on other sites
Advertisement
I solved it. Was a stupid fault...
wrong:
glFramebufferTexture3D(GL_FRAMEBUFFER, GL_TEXTURE_3D, GL_COLOR_ATTACHMENT0+i, this->textureController->getTexture("tex3d")->getHandler(), 0, i);


ok:

glFramebufferTexture3D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_3D, this->textureController->getTexture("tex3d")->getHandler(), 0, i);


there was also a framebuffer exception. Don't forget to check for that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement