Can an OpenGLES 2.0 framebuffer be bound to a texture and a renderbuffer at the same time?

两盒软妹~` 提交于 2019-12-05 14:27:11
Arttu Peltonen

Sounds like you might be a bit confused with FBO usage. If you need it, this should get you started: Apple Developer - Drawing offscreen. This could help too.

Renderbuffer is something you can bind to an FBO (framebuffer object). FBO is something you create when you don't want your rendering to be displayed immediately, but want to read the rendering result back or perform additional rendering to it. The way FBOs work in OpenGL ES 2.0, you have only one color attachment point available (GL_COLOR_ATTACHMENT0 - your fragment shader output variable gl_FragColor is connected to this attachment point), and it can only have one texture or renderbuffer attached to it. So to answer that last question, you cannot have an FBO that would simultaneously write color to a renderbuffer and a texture.

As for the first part of your question, it depends whether you are already using an FBO or the default framebuffer. Chances are the behavior you're looking for is something like this:

  1. bind an FBO
  2. render something to a texture attached to the FBO
  3. bind the default framebuffer
  4. use the texture from step 2 to affect rendering in your second renderpass.

Hope this answers your question even a little bit.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!