1

我为离屏渲染创建了一个帧缓冲区。我制作了一个没有设置数据的空纹理。我没有附加颜色渲染缓冲区,因为有纹理支持。

在代码中:

    //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);

它确实有效,但 xCode 分析器总是声称帧缓冲区没有附件。我在这里需要颜色渲染缓冲区吗?

4