OpenGL ES 2.x: any way to reuse depth buffer for off-screen and on-screen rendering?

后端 未结 1 868
情歌与酒
情歌与酒 2021-01-19 15:29

I\'m doing 2-pass rendering, where for the first pass I\'m rendering to a texture and for the second pass I\'m rendering to the screen.

I\'m rendering the same polyg

1条回答
  •  佛祖请我去吃肉
    2021-01-19 15:55

    From reading the OpenGL® ES Common Profile Specification Version 2.0.25 it appears that neither of these are possible.

    Section 4.4.2 says:

    Framebuffer-attachable images may be attached to, and detached from, application-created framebuffer objects. In contrast, the image attachments of the window-system-provided framebuffer may not be changed by OpenGL ES.

    (emphasis mine) So the second option in the question is not possible.

    Section 4.4.3 suggests that the first option isn't possible either...

    A renderbuffer object cannot be created with the name zero. If renderbuffer is zero, then any previous binding to target is broken and the target binding is restored to the initial state.

    In the initial state, the reserved name zero is bound to RENDERBUFFER. There is no renderbuffer object corresponding to the name zero, so client attempts to modify or query renderbuffer state for the target RENDERBUFFER while zero is bound will generate errors.

    ...though this is less explicit. It isn't clear if there's some other name that could be used to refer to the default framebuffer's renderbuffers, though it's hard to imagine what name would make more sense than 0 since it's used for the default elsewhere.

    0 讨论(0)
提交回复
热议问题