API翻译:glBindFramebuffer

来源:互联网 发布:狼雨seo网络工作室 编辑:程序博客网 时间:2024/06/13 03:25

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.

原创粉丝点击