new Framebuffer
A framebuffer is a target for draw and clear calls. It can contain color, depth, and stencil attachments that are written to in response to these calls. If the attachments are textures, they can be read in later rendering passes.
See:
Source:
Members
-
destroyAttachments :Boolean
-
When true, the framebuffer owns its attachments so they will be destroyed when Framebuffer#destroy is called or when a new attachment is assigned to an attachment point.
- Default Value:
- true
See:
Methods
-
destroy
-
Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.
Framebuffer attachments are only destoryed if the framebuffer owns them, i.e., destroyAttachments is true.
Once an object is destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception. Therefore, assign the return value (undefined
) to the object as done in the example.Throws:
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.Returns:
Example
var texture = context.createTexture2D({ width : 1, height : 1 }); framebuffer = context.createFramebuffer({ colorTextures : [texture] }); // ... framebuffer = framebuffer.destroy(); // texture is also destroyed.
-
getColorRenderbuffer
-
Returns a color renderbuffer attached to this framebuffer.
Parameters:
Name Type Description index
Number The index of the color renderbuffer attachment. Throws:
-
DeveloperError : index is required, must be greater than or equal to zero and must be less than the number of color attachments.
-
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.
Returns:
Texture The color renderbuffer attached to this framebuffer. -
-
getColorTexture
-
Returns a color texture attached to this framebuffer.
Parameters:
Name Type Description index
Number The index of the color texture attachment. Throws:
-
DeveloperError : index is required, must be greater than or equal to zero and must be less than the number of color attachments.
-
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.
Returns:
Texture The color texture attached to this framebuffer. -
-
getDepthRenderbuffer
-
Returns the depth renderbuffer attached to this framebuffer.
Throws:
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.Returns:
Texture The depth renderbuffer attached to this framebuffer. -
getDepthStencilRenderbuffer
-
Returns the depth-stencil renderbuffer attached to this framebuffer.
Throws:
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.Returns:
Texture The depth-stencil renderbuffer attached to this framebuffer. -
getDepthStencilTexture
-
Returns the depth-stencil texture attached to this framebuffer.
Throws:
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.Returns:
Texture The depth-stencil texture attached to this framebuffer. -
getDepthTexture
-
Returns the depth texture attached to this framebuffer.
Throws:
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.Returns:
Texture The depth texture attached to this framebuffer. -
getNumberOfColorAttachments
-
Returns the number of color textures or renderbuffers attached to this framebuffer.
Returns:
Number The number of color attachments. -
getStencilRenderbuffer
-
Returns the stencil renderbuffer attached to this framebuffer.
Throws:
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.Returns:
Texture The stencil renderbuffer attached to this framebuffer. -
hasDepthAttachment
-
Returns true if the framebuffer has a depth attachment. Depth attachments include depth and depth-stencil textures, and depth and depth-stencil renderbuffers. When rendering to a framebuffer, a depth attachment is required for the depth test to have effect.
Throws:
DeveloperError : This framebuffer was destroyed, i.e., destroy() was called.Returns:
Boolean Returns true if the framebuffer has a depth attachment; otherwise, false. -
isDestroyed
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception.Returns:
Boolean True if this object was destroyed; otherwise, false.See: