1

I created a framebuffer for offscreen rendering. I made an empty texture with no data set up. I did not attached a color renderbuffer since there is the texture backing.

In code:

    //Generate framebuffer, hook up renderbuffer.
    glGenFramebuffers(1, &_frameBufferName);
    glBindFramebuffer(GL_FRAMEBUFFER, _frameBufferName);

    //DON'T Attach texture to framebuffer (RGBA).
    //glGenRenderbuffers(1, &_colorRenderBufferName);        
    //glBindRenderbuffer(GL_RENDERBUFFER, _colorRenderBufferName);    

    //glRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA4, _layerWidth, _layerHeight);        
    //glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, _colorRenderBufferName);            

    glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _textureName, 0);
    glClear(GL_COLOR_BUFFER_BIT);

It works actually, but xCode profiler always claims that the framebuffer has no attachments. Do I need color renderbuffer here?

1
  • Or "refresh" somehow the texture before every frame I output? Apr 15, 2012 at 16:51

1 Answer 1

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.