Sign in to follow this  
ElementSTI

Render to 3D Texture

Recommended Posts

ElementSTI    100
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
ElementSTI    100
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this