new Framebuffer()
Offscreen drawing surface.
Properties:
Name | Type | Description |
---|---|---|
gl |
WebGLRenderingContext | The WebGL context. |
framebuffer |
WebGLFramebuffer | Handle to the framebuffer. |
width |
number | Framebuffer width. |
height |
number | Framebuffer height. |
colorAttachments |
Array | Array of color attachments. |
depthAttachment |
Texture | Renderbuffer | Depth attachment. |
appState |
Object | Tracked GL state. |
- Source:
Methods
colorTarget(index, attachment, targetopt) → {Framebuffer}
Attach a color target to this framebuffer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
index |
number | Color attachment index. | |
attachment |
Texture | Cubemap | Renderbuffer | The texture, cubemap or renderbuffer to attach. | |
target |
GLenum |
<optional> |
The texture target or layer to attach. If the texture is 3D or a texture array, defaults to 0, otherwise to TEXTURE_2D. Ignored for renderbuffers. |
- Source:
Returns:
The Framebuffer object.
- Type
- Framebuffer
delete() → {Framebuffer}
Delete this framebuffer.
- Source:
Returns:
The Framebuffer object.
- Type
- Framebuffer
depthTarget(texture, targetopt) → {Framebuffer}
Attach a depth target to this framebuffer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
texture |
Texture | Cubemap | Renderbuffer | The texture, cubemap or renderbuffer to attach. | |
target |
GLenum |
<optional> |
The texture target or layer to attach. If the texture is 3D or a texture array or renderbuffer, defaults to 0, otherwise to TEXTURE_2D. Ignored for renderbuffers. |
- Source:
Returns:
The Framebuffer object.
- Type
- Framebuffer
getStatus() → {GLenum}
Get the current status of this framebuffer.
- Source:
Returns:
The current status of this framebuffer.
- Type
- GLenum
resize(widthopt, heightopt) → {Framebuffer}
Resize all attachments.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
width |
number |
<optional> |
app.width | New width of the framebuffer. |
height |
number |
<optional> |
app.height | New height of the framebuffer. |
- Source:
Returns:
The Framebuffer object.
- Type
- Framebuffer
restore() → {Framebuffer}
Restore framebuffer after context loss.
- Source:
Returns:
The Framebuffer object.
- Type
- Framebuffer