How to show the content of renderbufferobject?
假设fbo1用作渲染目标,GL_COLOR_ATTACHMENT0_EXT 是一个RenderBufferObject,渲染结果输出到了RenderBufferObject中,
现在要把渲染的内容在屏幕上显示出来:
screen.w,screen.h 是屏幕或窗口的大小:
glBindFramebufferEXT( GL_READ_FRAMEBUFFER_EXT, fbo1.fboId );
glBindFramebufferEXT( GL_DRAW_FRAMEBUFFER_EXT, 0);//使用0表示屏幕,否则表示离屏渲染目标。
glBlitFramebufferEXT(0, 0, screen.w, fbo_screen.h,
0,0,fbo1.w,fbo1.h,
GL_COLOR_BUFFER_BIT,
GL_LINEAR);
参见framebuffer_blit.txt一文:
http://www.opengl.org/registry/specs/EXT/framebuffer_blit.txt
When READ_FRAMEBUFFER_BINDING_EXT is zero, i.e. the default
window-system-provided framebuffer, <src> must be one of the
values listed in table 4.4. FRONT and LEFT refer to the front left
buffer, BACK refers to the back left buffer, and RIGHT refers to
the front right buffer. The other constants correspond directly
to the buffers that they name. If the requested buffer is missing,
then the error INVALID_OPERATION is generated. For the default
window-system-provided framebuffer, the initial setting for
ReadBuffer is FRONT if there is no back buffer and BACK
otherwise.