API翻譯:glBindFramebuffer
Name
glBindFramebuffer
繫結一個named framebuffer object。
C Specification
void glBindFramebuffer( GLenum target,
GLuint framebuffer);
Parameters
target
指定framebuffer object要繫結的target。這個常量標識必須是GL_FRAMEBUFFER。
framebuffer
指定framebuffer object的名字。
Description
1.glBindFramebuffer讓你建立或使用一個named framebuffer object。呼叫glBindFramebuffer,把target設為GL_FRAMEBUFFER,把framebuffer設為the name of the new framebuffer object,將繫結這個framebuffer object name。當一個framebuffer object被繫結,之前的繫結將自動斷開。
2.Framebuffer object names是無符號整型。0值被保留,視窗系統用來提供預設framebuffer。Framebuffer object names和對應的framebuffer object contents被放置在當前GL rendering context的共享物件空間中。
3.You may use glGenFramebuffers to generate a set of new framebuffer object names.
4.當一個framebuffer object第一次被繫結時,它的3個關聯點(GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, and GL_STENCIL_ATTACHMENT) 的狀態是GL_NONE。不太確定,上原文吧:The state of a framebuffer object immediately after it is first bound is three attachment points (GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT, and GL_STENCIL_ATTACHMENT) each with GL_NONE as the object type.
5.當一個非0的framebuffer object name被繫結,GL在target GL_FRAMEBUFFER的上的操作將影響繫結的framebuffer object,對target GL_FRAMEBUFFER的查詢,或者framebuffer的細節如GL_DEPTH_BITS(從繫結的framebuffer object返回的狀態)。當0值的framebuffer object name被繫結,作為初始狀態,企圖修改或查詢target GL_FRAMEBUFFER的狀態將會生成GL_INVALID_OPERATION錯誤。
6.當一個非零framebuffer object name被繫結,所有對這個framebuffer的渲染(with glDrawArrays and glDrawElements)和從這個framebuffer中讀(with glReadPixels, glCopyTexImage2D, or glCopyTexSubImage2D),將使用關聯到這個application-created framebuffer object的images,而不是預設的window-system-provided framebuffer.
7.應用程式建立的framebuffer objects不同於預設的視窗系統提供的framebuffer的幾個方面。第一,他們擁有可更改的關聯a color buffer, a depth buffer, and a stencil buffer的指向framebuffer attachable images的指標,這些images可以被attached and detached.第二,被關聯的images的大小和格式,可以被GL完全控制,且不會被window-system事件影響,比如畫素格式選擇,視窗大小重置,和改變顯示模式。第三,當對一個application created framebuffer object進行rendering to or reading,畫素擁有權測試一直是成功 (i.e. they own all their pixels)。第四,沒有可見的color buffer bitplanes,只有一個單一的”off-screen” color image attachment, 所以front and back buffers or swapping是沒有意義的。最後,這裡沒有多重取樣(multisample)buffer, 所以implementation-dependent state的值GL_SAMPLES and GL_SAMPLE_BUFFERS 都是0.
8.A framebuffer object binding created with glBindFramebuffer remains active until a different framebuffer object name is bound, or until the bound framebuffer object is deleted with glDeleteFramebuffers.
Notes
Queries of implementation-dependent pixel depths and related state are derived from the currently bound framebuffer object. These include GL_RED_BITS, GL_GREEN_BITS, GL_BLUE_BITS, GL_ALPHA_BITS, GL_DEPTH_BITS, GL_STENCIL_BITS, GL_IMPLEMENTATION_COLOR_READ_TYPE, GL_IMPLEMENTATION_COLOR_READ_FORMAT, GL_SAMPLES, and GL_SAMPLE_BUFFERS.