定义:在一个片元着色器中同时写到多个渲染缓存的能力。MRT
设置片元的out变量与帧缓存附件的对应关系。
layout (location = 0) out vec4 color; //输出颜色与颜色附件0对应
layout (location = 1) out vec4 normal;//输出颜色与颜色附件1对应
选择颜色缓存来进行读写操作
设置可以进行写入或者清除操作的颜色缓存。
glDrawBuffer(GLenum mode);
GLenum buffers[] = {GL_COLOR_ATTACHMENT0,GL_COLOR_ATTACHMENTS1}
glDrawBuffers(GLsizei n, const GLenum * buffers);
设置可用作像素读取的缓存。
void glReadBuffer(GLenum mode);
像素读取相关函数:
glReadPixels()
glCopyTexImage*()
glCopyTexSubImage*()
glReadBuffer()
glEnablei(capability,index)