且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何合并两个FBO?

更新时间:2022-05-26 22:34:37

设置屏幕外的帧缓冲区以直接渲染到纹理.该链接向您展示了如何:

Set up your offscreen framebuffers to render directly to a texture. This link shows you how:

http://developer.apple.com/iphone/library/documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/WorkingwithEAGLContexts/WorkingwithEAGLContexts.html#//apple_ref/doc/uid/TP40008793-CH103-SW7

为了我和你的利益,让我花点时间描述一下帧缓冲区和渲染缓冲区.帧缓冲区就像一个接受OpenGL渲染命令的端口.必须先将其附加到纹理或渲染缓冲区,然后才能查看或使用渲染输出.您可以选择使用glFramebufferTexture2DOES附加纹理还是使用glFramebufferRenderbufferOES附加渲染缓冲区.渲染缓冲区就像保存渲染结果的栅格图像一样.栅格图像的存储由OpenGL管理.如果希望图像显示在屏幕上而不是屏幕外缓冲区,请使用-[EAGLContext renderBufferStorage:fromDrawable:]来将EAGLContext的存储与renderbuffer一起使用.这段代码在OpenGL ES项目模板中.

Let me take a moment to describe framebuffers and renderbuffers, for my benefit and yours. A framebuffer is like a port that accepts OpenGL rendering commands. It has to be attached to a texture or a renderbuffer before you can see or use the rendering output. You can choose between attaching a texture using glFramebufferTexture2DOES or a renderbuffer using glFramebufferRenderbufferOES. A renderbuffer is like a raster image that holds the results of rendering. Storage for the raster image is managed by OpenGL. If you want the image to appear on the screen instead of an offscreen buffer, you use -[EAGLContext renderBufferStorage:fromDrawable:] to use the EAGLContext's storage with the renderbuffer. This code is in the OpenGL ES project template.

您可能不需要视图帧缓冲区,因为在将场景背景和用户层渲染为纹理之后,您可以将这些纹理绘制到渲染缓冲区中(即,绘制到与屏幕上渲染缓冲区关联的帧缓冲区中).

You probably don't need the view framebuffer, since after rendering the scene background and the user layer to textures, you can draw those textures into the renderbuffer (that is, into the framebuffer associated with the onscreen renderbuffer).