Can framebuffer OpenGLES 2.0 be tied to texture and rendering at the same time?

Brad Larson offers great code here and here for 'rendering your scene in a framebuffer' supported texture, but it is unclear whether the same framebuffer that I use for the rest of the drawing is.

If you attach renderbuffer to framebuffer, can framebuffer also display texture with the same call?

+4
source share
1 answer

Sounds like you might be a little confused about using FBO. If you need it, you should start: Apple Developer - off-screen painting . It may also help.

Renderbuffer is something you can associate with an FBO (framebuffer object). FBO is what you create when you don’t want your rendering to appear immediately, but want to read the rendering result or perform additional rendering. How FBOs work in OpenGL ES 2.0, you have only one color anchor point (GL_COLOR_ATTACHMENT0 - your fragment shader output variable gl_FragColor is connected to this anchor point), and only one texture or rendering can be attached to it. Therefore, to answer this last question, you cannot have an FBO that simultaneously writes color to renderbuffer and texture.

As for the first part of your question, it depends on whether you are already using FBO or the default framebuffer. Most likely, the behavior you are looking for looks something like this:

  • tie fbo
  • do something texture attached to fbo
  • binds default framebuffer
  • use the texture from step 2 to affect the rendering in your second render window.

Hope this answers your question a bit.

+3
source

Source: https://habr.com/ru/post/1497846/


All Articles